浏览代码

Lua : do not generate references to self inside of closures: i.e. no _bind usage

Justin Donaldson 10 年之前
父节点
当前提交
86c6c76266
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      genlua.ml

+ 4 - 0
genlua.ml

@@ -415,6 +415,9 @@ and gen_expr ctx e =
 		gen_value ctx x;
 		print ctx ")"
 	| TField (x,FClosure (_,f)) ->
+		gen_value ctx x;
+		print ctx "%s" (field f.cf_name);
+		(* TODO: More _bind fixes:
 		add_feature ctx "use._bind";
 		(match x.eexpr with
 		| TConst _ | TLocal _ ->
@@ -427,6 +430,7 @@ and gen_expr ctx e =
 			print ctx "(__=";
 			gen_value ctx x;
 			print ctx ",_bind(__,__%s))" (field f.cf_name))
+			*)
 	| TEnumParameter (x,_,i) ->
 		gen_value ctx x;
 		print ctx "{%i}" (i + 2)