[m-rev.] diff: Add type cast in construction of direct arg functor value.
Peter Wang
novalazy at gmail.com
Fri Sep 19 18:02:41 AEST 2014
Branches: master, 14.01
Add a type cast to the code generated by ml_gen_direct_arg_deconstruct
to construct a value with a direct argument functor. The cast exists in
the same code generated by ml_gen_direct_arg_construct.
compiler/ml_unify_gen.m:
As above.
diff --git a/compiler/ml_unify_gen.m b/compiler/ml_unify_gen.m
index 1f766b9..7059e0f 100644
--- a/compiler/ml_unify_gen.m
+++ b/compiler/ml_unify_gen.m
@@ -2099,7 +2099,9 @@ ml_gen_direct_arg_deconstruct(ModuleInfo, Mode, Ptag,
->
ml_gen_box_or_unbox_rval(ModuleInfo, ArgType, VarType,
native_if_possible, ml_lval(ArgLval), ArgRval),
- Statement = ml_gen_assign(VarLval, ml_mkword(Ptag, ArgRval), Context),
+ MLDS_Type = mercury_type_to_mlds_type(ModuleInfo, VarType),
+ CastRval = ml_unop(cast(MLDS_Type), ml_mkword(Ptag, ArgRval)),
+ Statement = ml_gen_assign(VarLval, CastRval, Context),
Statements = [Statement]
;
% Unused - unused: the unification has no effect.
More information about the reviews
mailing list