浏览代码

inline enumIndex access

Simon Krajewski 12 年之前
父节点
当前提交
b93abdbb94
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      matcher.ml

+ 4 - 3
matcher.ml

@@ -911,9 +911,10 @@ let convert_switch ctx st cases loop =
 		let ttype = match follow (Typeload.load_instance ctx { tpackage = ["std"]; tname="Type"; tparams=[]; tsub = None} p true) with TInst(c,_) -> c | t -> assert false in
 		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 [t_dynamic] ctx.t.tint) p in
-		(* make_call cctx.ctx ef [e_st] cctx.ctx.t.tint p,true *)
-		mk (TCall (ef,[e_st])) ctx.t.tint p
+		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
 	in
 	let e = match follow st.st_type with
 	| TEnum(_) ->