Sfoglia il codice sorgente

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

Justin Donaldson 10 anni fa
parent
commit
86c6c76266
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4 0
      genlua.ml

+ 4 - 0
genlua.ml

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