浏览代码

avoid dumb recursion callback mess in unification callback handler

Simon Krajewski 10 年之前
父节点
当前提交
4ea01aa0be
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      codegen.ml

+ 6 - 5
codegen.ml

@@ -1778,11 +1778,12 @@ module UnificationCallback = struct
 		| _ ->
 		| _ ->
 			List.map (fun e -> f e t_dynamic) el
 			List.map (fun e -> f e t_dynamic) el
 
 
-	let rec run f e =
+	let rec run ff e =
 		let f e t =
 		let f e t =
-			(* TODO: I don't think this should cause errors on Flash target *)
-			(* if not (type_iseq e.etype t) then f e t else e *)
-			f e t
+			if not (type_iseq e.etype t) then
+				ff e t
+			else
+				e
 		in
 		in
 		let check e = match e.eexpr with
 		let check e = match e.eexpr with
 			| TBinop((OpAssign | OpAssignOp _ as op),e1,e2) ->
 			| TBinop((OpAssign | OpAssignOp _ as op),e1,e2) ->
@@ -1837,7 +1838,7 @@ module UnificationCallback = struct
 				tf_stack := List.tl !tf_stack;
 				tf_stack := List.tl !tf_stack;
 				etf
 				etf
 			| _ ->
 			| _ ->
-				check (Type.map_expr (run f) e)
+				check (Type.map_expr (run ff) e)
 end;;
 end;;
 
 
 module DeprecationCheck = struct
 module DeprecationCheck = struct