Browse Source

remove enumIndex cruft from analyzer and eval

Simon Krajewski 8 years ago
parent
commit
531e60d717
2 changed files with 2 additions and 26 deletions
  1. 1 7
      src/macro/eval/evalJit.ml
  2. 1 19
      src/optimization/analyzer.ml

+ 1 - 7
src/macro/eval/evalJit.ml

@@ -303,8 +303,7 @@ and jit_expr jit return e =
 		if l < 256 then begin
 			let cases = Array.init l (fun i -> try IntMap.find (i + !shift) !h with Not_found -> exec_def) in
 			if !shift = 0 then begin match (Texpr.skip e1).eexpr with
-				| TEnumIndex e1
-				| TCall({eexpr = TField(_,FStatic({cl_path=[],"Type"},{cf_name="enumIndex"}))},[e1]) ->
+				| TEnumIndex e1 ->
 					let exec = jit_expr jit false e1 in
 					emit_enum_switch_array exec cases exec_def e1.epos
 				| _ ->
@@ -564,11 +563,6 @@ and jit_expr jit return e =
 				emit_method_call exec name execs e.epos
 			in
 			begin match fa with
-				| FStatic({cl_path=[],"Type"},{cf_name="enumIndex"}) ->
-					begin match execs with
-						| [exec] -> emit_enum_index exec
-						| _ -> assert false
-					end
 				| FStatic({cl_path=[],"StringTools"},{cf_name="fastCodeAt"}) ->
 					begin match execs with
 						| [exec1;exec2] -> emit_string_cca exec1 exec2 e.epos

+ 1 - 19
src/optimization/analyzer.ml

@@ -425,15 +425,6 @@ module ConstPropagation = DataFlow(struct
 					| EnumValue(i,_) -> Const (TInt (Int32.of_int i))
 					| _ -> raise Exit
 				end;
-			| TCall ({ eexpr = TField (_,FStatic({cl_path=[],"Type"} as c,({cf_name="enumIndex"} as cf)))},[e1]) when ctx.com.platform = Eval ->
-				begin match follow e1.etype,eval bb e1 with
-					| TEnum _,EnumValue(i,_) -> Const (TInt (Int32.of_int i))
-					| _,e1 ->
-						begin match Optimizer.api_inline2 ctx.com c cf.cf_name [wrap e1] e.epos with
-							| None -> raise Exit
-							| Some e -> eval bb e
-						end
-				end
 			| TCall ({ eexpr = TField (_,FStatic(c,cf))},el) ->
 				let el = List.map (eval bb) el in
 				let el = List.map wrap el in
@@ -444,16 +435,7 @@ module ConstPropagation = DataFlow(struct
 			| TParenthesis e1 | TMeta(_,e1) | TCast(e1,None) ->
 				eval bb e1
 			| _ ->
-				let e1 = match ctx.com.platform,e.eexpr with
-					| Js,TArray(e1,{eexpr = TConst(TInt i)}) when Int32.to_int i = 1 -> e1
-					| Cpp,TCall({eexpr = TField(e1,FDynamic "__Index")},[]) -> e1
-					| Neko,TField(e1,FDynamic "index") -> e1
-					| _ -> raise Exit
-				in
-				begin match follow e1.etype,eval bb e1 with
-					| TEnum _,EnumValue(i,_) -> Const (TInt (Int32.of_int i))
-					| _ -> raise Exit
-				end
+				raise Exit
 		in
 		try
 			eval bb e