|
@@ -578,6 +578,19 @@ struct
|
|
|
| _ -> true
|
|
|
in
|
|
|
if need_second_cast then { e with eexpr = TCast(mk_cast (follow e.etype) (run expr), c) } else Type.map_expr run e*)
|
|
|
+ | TBinop( (Ast.OpAssignOp OpAdd as op), e1, e2)
|
|
|
+ | TBinop( (Ast.OpAdd as op), e1, e2) when is_string e.etype || is_string e1.etype || is_string e2.etype ->
|
|
|
+ let is_assign = match op with Ast.OpAssignOp _ -> true | _ -> false in
|
|
|
+ let mk_to_string e = { e with eexpr = TCall( mk_static_field_access_infer runtime_cl "toString" e.epos [], [run e] ); etype = gen.gcon.basic.tstring } in
|
|
|
+ let check_cast e = match gen.greal_type e.etype with
|
|
|
+ | TDynamic _
|
|
|
+ | TAbstract({ a_path = ([], "Float") }, [])
|
|
|
+ | TAbstract({ a_path = ([], "Single") }, []) ->
|
|
|
+ mk_to_string e
|
|
|
+ | _ -> run e
|
|
|
+ in
|
|
|
+
|
|
|
+ { e with eexpr = TBinop(op, (if is_assign then run e1 else check_cast e1), check_cast e2) }
|
|
|
| TCast(expr, _) when is_string e.etype ->
|
|
|
{ e with eexpr = TCall( mk_static_field_access_infer runtime_cl "toString" expr.epos [], [run expr] ) }
|
|
|
|
|
@@ -1951,7 +1964,7 @@ let configure gen =
|
|
|
{ ecall with eexpr = TCall(efield, elist) }
|
|
|
);
|
|
|
|
|
|
- CastDetect.configure gen (CastDetect.default_implementation gen (Some (TEnum(empty_e, []))) true);
|
|
|
+ CastDetect.configure gen (CastDetect.default_implementation gen ~native_string_cast:false (Some (TEnum(empty_e, []))) true);
|
|
|
|
|
|
(*FollowAll.configure gen;*)
|
|
|
|