浏览代码

more allow_transform fixes

Nicolas Cannasse 3 年之前
父节点
当前提交
51ffdf2aa3
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 4 1
      src/context/abstractCast.ml
  2. 3 0
      src/typing/calls.ml

+ 4 - 1
src/context/abstractCast.ml

@@ -230,7 +230,10 @@ let handle_abstract_casts ctx e =
 				| TAbstract({a_impl = Some c} as a,tl) ->
 					begin try
 						let cf = PMap.find "toString" c.cl_statics in
-						make_static_call ctx c cf a tl [e1] ctx.t.tstring e.epos
+						if not ctx.allow_transform then
+							{ e1 with etype = ctx.t.tstring; epos = e.epos }
+						else
+							make_static_call ctx c cf a tl [e1] ctx.t.tstring e.epos
 					with Not_found ->
 						e
 					end

+ 3 - 0
src/typing/calls.ml

@@ -283,6 +283,9 @@ let rec needs_temp_var e =
 	| _ -> true
 
 let call_to_string ctx ?(resume=false) e =
+	if not ctx.allow_transform then
+		{ e with etype = ctx.t.tstring }
+	else
 	let gen_to_string e =
 		(* Ignore visibility of the toString field. *)
 		ctx.meta <- (Meta.PrivateAccess,[],e.epos) :: ctx.meta;