Browse Source

Lua: Simplify anonymous value type field calls

Justin Donaldson 9 years ago
parent
commit
6d29e43949
1 changed files with 3 additions and 6 deletions
  1. 3 6
      src/generators/genlua.ml

+ 3 - 6
src/generators/genlua.ml

@@ -400,13 +400,10 @@ let rec gen_call ctx e el in_value =
 		concat ctx "," (gen_value ctx) el;
 		spr ctx ")";
 	| TField ( { eexpr = TConst(TInt _ | TFloat _| TString _| TBool _) } as e , ((FInstance _ | FAnon _) as ef)), el ->
-		(* TODO: Come up with better workaround for dealing with invoked methods on constants e.g. "foo".charAt(0); *)
-		spr ctx "(function(x) return x:";
-		print ctx "%s" (field_name ef);
-		spr ctx "(";
-		concat ctx "," (gen_value ctx) el;
-		spr ctx ") end )(";
+		spr ctx ("(");
 		gen_value ctx e;
+		print ctx ("):%s(") (field_name ef);
+		concat ctx "," (gen_value ctx) el;
 		spr ctx ")";
 	| TField (e, ((FInstance _ | FAnon _ | FDynamic _) as ef)), el ->
 		gen_value ctx e;