Browse Source

fixed flash VerifyError issue with pattern matching

Nicolas Cannasse 12 years ago
parent
commit
63a1926598
2 changed files with 3 additions and 5 deletions
  1. 2 2
      genswf9.ml
  2. 1 3
      matcher.ml

+ 2 - 2
genswf9.ml

@@ -1038,11 +1038,11 @@ let rec gen_expr_content ctx retval e =
 		ctx.infos.icond <- true;
 		no_value ctx retval
 	| TField _
-	| TEnumParameter _
 	| TLocal _
 	| TTypeExpr _ ->
 		getvar ctx (gen_access ctx e Read)
-	| TArray _ ->
+	(* both accesses return dynamic so let's cast them to the real type *)
+	| TEnumParameter _ | TArray _ ->
 		getvar ctx (gen_access ctx e Read);
 		coerce ctx (classify ctx e.etype)
 	| TBinop (op,e1,e2) ->

+ 1 - 3
matcher.ml

@@ -912,9 +912,7 @@ let convert_switch ctx st cases loop =
 		let cf = PMap.find "enumIndex" ttype.cl_statics in
 		let ec = (!type_module_type_ref) ctx (TClassDecl ttype) None p in
 		let ef = mk (TField(ec, FStatic(ttype,cf))) (tfun [e_st.etype] ctx.t.tint) p in
-		(* TODO: inlining this causes errors on flash 9 for whatever reason *)
-		if ctx.com.platform = Flash then mk (TCall (ef,[e_st])) ctx.t.tint p
-		else make_call ctx ef [e_st] ctx.t.tint p
+		make_call ctx ef [e_st] ctx.t.tint p
 	in
 	let e = match follow st.st_type with
 	| TEnum(_) ->