2
0
Эх сурвалжийг харах

[js] handle @:selfCall in gen_expr TField case instead of gen_call (see https://github.com/HaxeFoundation/haxe/issues/3441#issuecomment-64015831)

Dan Korostelev 10 жил өмнө
parent
commit
594630e62d
1 өөрчлөгдсөн 2 нэмэгдсэн , 5 устгасан
  1. 2 5
      genjs.ml

+ 2 - 5
genjs.ml

@@ -461,11 +461,6 @@ let rec gen_call ctx e el in_value =
 			gen_value ctx e;
 			spr ctx ")";
 		end
-	| TField (eo, (FInstance(_,_,cf) | FStatic(_,cf) | FAnon(cf))), _ when Meta.has Meta.SelfCall cf.cf_meta ->
-		gen_value ctx eo;
-		spr ctx "(";
-		concat ctx "," (gen_value ctx) el;
-		spr ctx ")"
 	| _ ->
 		gen_value ctx e;
 		spr ctx "(";
@@ -523,6 +518,8 @@ and gen_expr ctx e =
 		print ctx "[%i]" (i + 2)
 	| TField ({ eexpr = TConst (TInt _ | TFloat _) } as x,f) ->
 		gen_expr ctx { e with eexpr = TField(mk (TParenthesis x) x.etype x.epos,f) }
+	| TField (x, (FInstance(_,_,f) | FStatic(_,f) | FAnon(f))) when Meta.has Meta.SelfCall f.cf_meta ->
+		gen_value ctx x;
 	| TField (x,f) ->
 		gen_value ctx x;
 		let name = field_name f in