Browse Source

[as3] Cast to the proper type when generating interface field access (really closes #1142), thanks @waneck for surfacing it :-P

Dan Korostelev 11 years ago
parent
commit
af4826bd90
1 changed files with 2 additions and 2 deletions
  1. 2 2
      genas3.ml

+ 2 - 2
genas3.ml

@@ -580,10 +580,10 @@ and gen_expr ctx e =
 		print ctx " %s " (Ast.s_binop op);
 		gen_value_op ctx e2;
 	(* variable fields on interfaces are generated as (class["field"] as class) *)
-	| TField ({etype = TInst({cl_interface = true} as c,_)} as e,FInstance (_,{ cf_name = s }))
+	| TField ({etype = TInst({cl_interface = true} as c,_)} as ei,FInstance (_,{ cf_name = s }))
 		when (try (match (PMap.find s c.cl_fields).cf_kind with Var _ -> true | _ -> false) with Not_found -> false) ->
 		spr ctx "(";
-		gen_value ctx e;
+		gen_value ctx ei;
 		print ctx "[\"%s\"]" s;
 		print ctx " as %s)" (type_str ctx e.etype e.epos);
 	| TField({eexpr = TArrayDecl _} as e1,s) ->