Parcourir la source

removed TEnumField, use TField (_,FEnum (en,ef)) instead

Nicolas Cannasse il y a 12 ans
Parent
commit
3f60436205
15 fichiers modifiés avec 40 ajouts et 85 suppressions
  1. 3 3
      codegen.ml
  2. 1 2
      dce.ml
  3. 0 3
      genas3.ml
  4. 0 5
      gencpp.ml
  5. 1 4
      genjs.ml
  6. 0 2
      genneko.ml
  7. 1 6
      genphp.ml
  8. 0 1
      genswf.ml
  9. 1 8
      genswf8.ml
  10. 0 9
      genswf9.ml
  11. 0 1
      interp.ml
  12. 4 10
      matcher.ml
  13. 12 14
      optimizer.ml
  14. 2 7
      type.ml
  15. 15 10
      typer.ml

+ 3 - 3
codegen.ml

@@ -1173,8 +1173,6 @@ let rename_local_vars com e =
 			(match def with None -> () | Some e -> loop e);
 		| TTypeExpr t ->
 			check t
-		| TEnumField (e,_) ->
-			check (TEnumDecl e)
 		| TNew (c,_,_) ->
 			Type.iter loop e;
 			check (TClassDecl c);
@@ -1588,11 +1586,13 @@ let rec constructor_side_effects e =
 	match e.eexpr with
 	| TBinop (op,_,_) when op <> OpAssign ->
 		true
+	| TField (_,FEnum _) ->
+		false
 	| TUnop _ | TArray _ | TField _ | TCall _ | TNew _ | TFor _ | TWhile _ | TSwitch _ | TMatch _ | TReturn _ | TThrow _ ->
 		true
 	| TBinop _ | TTry _ | TIf _ | TBlock _ | TVars _
 	| TFunction _ | TArrayDecl _ | TObjectDecl _
-	| TParenthesis _ | TTypeExpr _ | TEnumField _ | TLocal _
+	| TParenthesis _ | TTypeExpr _ | TLocal _
 	| TConst _ | TContinue | TBreak | TCast _ ->
 		try
 			Type.iter (fun e -> if constructor_side_effects e then raise Exit) e;

+ 1 - 2
dce.ml

@@ -252,8 +252,7 @@ and expr dce e =
 	| TCast(e, Some (TEnumDecl en)) ->
 		mark_t dce (TEnum(en,[]));
 		expr dce e;
-	| TTypeExpr (TEnumDecl e)
-	| TEnumField(e,_) ->
+	| TTypeExpr (TEnumDecl e) ->
 		mark_t dce (TEnum(e,[]));
 	| TCall ({eexpr = TLocal ({v_name = "__define_feature__"})},[{eexpr = TConst (TString ft)};e]) ->
 		Common.add_feature dce.com ft;

+ 0 - 3
genas3.ml

@@ -533,8 +533,6 @@ and gen_expr ctx e =
 		gen_constant ctx e.epos c
 	| TLocal v ->
 		spr ctx (s_ident v.v_name)
-	| TEnumField (en,s) ->
-		print ctx "%s.%s" (s_path ctx true en.e_path e.epos) (s_ident s)
 	| TArray ({ eexpr = TLocal { v_name = "__global__" } },{ eexpr = TConst (TString s) }) ->
 		let path = Ast.parse_path s in
 		spr ctx (s_path ctx false path e.epos)
@@ -842,7 +840,6 @@ and gen_value ctx e =
 		v()
 	| TConst _
 	| TLocal _
-	| TEnumField _
 	| TArray _
 	| TBinop _
 	| TField _

+ 0 - 5
gencpp.ml

@@ -669,7 +669,6 @@ let rec iter_retval f retval e =
 	match e.eexpr with
 	| TConst _
 	| TLocal _
-	| TEnumField _
 	| TBreak
 	| TContinue
 	| TTypeExpr _ ->
@@ -1368,7 +1367,6 @@ and gen_expression ctx retval expression =
 	| TCall (func, arg_list) ->
 		let rec is_variable e = match e.eexpr with
 		| TField _ -> false
-		| TEnumField _ -> false
 		| TLocal { v_name = "__global__" } -> false
 		| TParenthesis p -> is_variable p
 		| TCast (e,None) -> is_variable e
@@ -1446,9 +1444,6 @@ and gen_expression ctx retval expression =
 
 
 	| TLocal v -> output (keyword_remap v.v_name);
-	| TEnumField (enum, name) ->
-			output ("::" ^ (join_class_path enum.e_path "::") ^ "_obj::" ^ name);
-		   if ( not calling ) then output "_dyn()";
 	| TArray (array_expr,_) when (is_null array_expr) -> output "Dynamic()"
 	| TArray (array_expr,index) ->
 		let dynamic =  is_dynamic_in_cpp ctx array_expr in

+ 1 - 4
genjs.ml

@@ -404,8 +404,6 @@ and gen_expr ctx e =
 	match e.eexpr with
 	| TConst c -> gen_constant ctx e.epos c
 	| TLocal v -> spr ctx (ident v.v_name)
-	| TEnumField (e,s) ->
-		print ctx "%s%s" (ctx.type_accessor (TEnumDecl e)) (field s)
 	| TArray (e1,{ eexpr = TConst (TString s) }) when valid_js_ident s ->
 		gen_value ctx e1;
 		spr ctx (field s)
@@ -444,7 +442,7 @@ and gen_expr ctx e =
 	| TField (x,f) ->
 		gen_value ctx x;
 		let name = field_name f in
-		spr ctx (match f with FStatic _ -> static_field name | FInstance _ | FAnon _ | FDynamic _ | FClosure _ -> field name)
+		spr ctx (match f with FStatic _ | FEnum _ -> static_field name | FInstance _ | FAnon _ | FDynamic _ | FClosure _ -> field name)
 	| TTypeExpr t ->
 		spr ctx (ctx.type_accessor t)
 	| TParenthesis e ->
@@ -773,7 +771,6 @@ and gen_value ctx e =
 	match e.eexpr with
 	| TConst _
 	| TLocal _
-	| TEnumField _
 	| TArray _
 	| TBinop _
 	| TField _

+ 0 - 2
genneko.ml

@@ -218,8 +218,6 @@ and gen_expr ctx e =
 			(EArray (ident p v.v_name,int p 0),p)
 		else
 			ident p v.v_name
-	| TEnumField (e,f) ->
-		field p (gen_type_path p e.e_path) f
 	| TArray (e1,e2) ->
 		(EArray (gen_expr ctx e1,gen_expr ctx e2),p)
 	| TBinop (OpAssign,{ eexpr = TField (e1,f) },e2) ->

+ 1 - 6
genphp.ml

@@ -960,10 +960,6 @@ and gen_expr ctx e =
 		gen_constant ctx e.epos c
 	| TLocal v ->
 		spr ctx ("$" ^ (try PMap.find v.v_name ctx.locals with Not_found -> (s_ident_local v.v_name)))
-	| TEnumField (en,s) ->
-		(match (try PMap.find s en.e_constrs with Not_found -> error ("Unknown local " ^ s) e.epos).ef_type with
-		| TFun (args,_) -> print ctx "%s::%s" (s_path ctx en.e_path en.e_extern e.epos) (s_ident s)
-		| _ -> print ctx "%s::$%s" (s_path ctx en.e_path en.e_extern e.epos) (s_ident s))
 	| TArray (e1,e2) ->
 		(match e1.eexpr with
 		| TCall _
@@ -1706,7 +1702,7 @@ and canbe_ternary_param e =
 	| TTypeExpr _
 	| TConst _
 	| TLocal _
-	| TEnumField _
+	| TField (_,FEnum _)
 	| TParenthesis _
 	| TObjectDecl _
 	| TArrayDecl _
@@ -1733,7 +1729,6 @@ and gen_value ctx e =
 	| TTypeExpr _
 	| TConst _
 	| TLocal _
-	| TEnumField _
 	| TArray _
 	| TBinop _
 	| TField _

+ 0 - 1
genswf.ml

@@ -582,7 +582,6 @@ let build_dependencies t =
 	and add_expr e =
 		match e.eexpr with
 		| TTypeExpr t -> add_path (Type.t_path t) DKExpr
-		| TEnumField (e,_) -> add_path e.e_path DKExpr
 		| TNew (c,pl,el) ->
 			add_path c.cl_path DKExpr;
 			List.iter add_type pl;

+ 1 - 8
genswf8.ml

@@ -620,12 +620,6 @@ let rec gen_access ?(read_write=false) ctx forcall e =
 			gen_expr ctx true eb;
 		end;
 		VarObj
-	| TEnumField (en,f) ->
-		getvar ctx (gen_path ctx en.e_path false);
-		push ctx [VStr (f,false)];
-		(match follow e.etype with
-		| TFun _ -> VarClosure
-		| _ -> VarObj)
 	| TTypeExpr t ->
 		(match t with
 		| TClassDecl c -> gen_path ctx c.cl_path c.cl_extern
@@ -975,8 +969,7 @@ and gen_expr_2 ctx retval e =
 	| TField _
 	| TArray _
 	| TLocal _
-	| TTypeExpr _
-	| TEnumField _ ->
+	| TTypeExpr _ ->
 		getvar ctx (gen_access ctx false e)
 	| TConst c ->
 		gen_constant ctx c e.epos

+ 0 - 9
genswf9.ml

@@ -974,10 +974,6 @@ let rec gen_expr_content ctx retval e =
 		no_value ctx retval;
 	| TParenthesis e ->
 		gen_expr ctx retval e
-	| TEnumField (e,s) ->
-		let id = type_path ctx e.e_path in
-		write ctx (HGetLex id);
-		write ctx (HGetProp (ident s));
 	| TObjectDecl fl ->
 		List.iter (fun (name,e) ->
 			write ctx (HString name);
@@ -1504,11 +1500,6 @@ and gen_call ctx retval e el r =
 			coerce ctx (classify ctx r);
 		end else
 			write ctx (HCallPropVoid (id,List.length el))
-	| TEnumField (e,f) , _ ->
-		let id = type_path ctx e.e_path in
-		write ctx (HGetLex id);
-		List.iter (gen_expr ctx true) el;
-		write ctx (HCallProperty (ident f,List.length el));
 	| _ ->
 		gen_expr ctx true e;
 		write ctx HGetGlobalScope;

+ 0 - 1
interp.ml

@@ -4357,7 +4357,6 @@ let rec make_ast e =
 	| TConst c ->
 		EConst (mk_const c)
 	| TLocal v -> EConst (Ident v.v_name)
-	| TEnumField (en,f) -> EField (mk_path en.e_path e.epos,f)
 	| TArray (e1,e2) -> EArray (make_ast e1,make_ast e2)
 	| TBinop (op,e1,e2) -> EBinop (op, make_ast e1, make_ast e2)
 	| TField (e,f) -> EField (make_ast e, Type.field_name f)

+ 4 - 10
matcher.ml

@@ -284,8 +284,7 @@ let to_pattern mctx e st =
 			| TEnum(en,pl)
 			| TFun(_,TEnum(en,pl)) ->
 				let ef = match ec.eexpr with
-					| TEnumField(_,s)
-					| TField({ eexpr = TTypeExpr (TEnumDecl _) },FClosure (_,{ cf_name = s })) -> PMap.find s en.e_constrs
+					| TField (_,FEnum (_,f)) -> f
 					| _ -> error ("Expected constructor for enum " ^ (s_type_path en.e_path)) p
 				in
 				let mono_map,monos,tpl = List.fold_left (fun (mm,ml,tpl) (n,t) ->
@@ -326,7 +325,8 @@ let to_pattern mctx e st =
 				let ec = match tc with
 					| TEnum(en,pl) ->
 						let ef = PMap.find s en.e_constrs in
-						mk (TEnumField (en,s)) (apply_params en.e_types pl ef.ef_type) p
+						let et = mk (TTypeExpr (TEnumDecl en)) (TAnon { a_fields = PMap.empty; a_status = ref (EnumStatics en) }) p in
+						mk (TField (et,FEnum (en,ef))) (apply_params en.e_types pl ef.ef_type) p
 					| _ ->
 						let old = ctx.untyped in
 						ctx.untyped <- true;
@@ -338,13 +338,7 @@ let to_pattern mctx e st =
 						e
 				in
 				(match ec.eexpr with
-					| TEnumField(en,s) ->
-						let ef = PMap.find s en.e_constrs in
-						unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_types) ef tc;
-						mk_con_pat (CEnum(en,ef)) [] st.st_type p
-					| TField ({ eexpr = TTypeExpr (TEnumDecl en) },f) ->
-						let s = field_name f in
-						let ef = PMap.find s en.e_constrs in
+					| TField (_,FEnum (en,ef)) ->
 						unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_types) ef tc;
 						mk_con_pat (CEnum(en,ef)) [] st.st_type p
                     | TConst c ->

+ 12 - 14
optimizer.ml

@@ -27,7 +27,7 @@ open Typecore
 let has_side_effect e =
 	let rec loop e =
 		match e.eexpr with
-		| TConst _ | TLocal _ | TEnumField _ | TTypeExpr _ | TFunction _ -> ()
+		| TConst _ | TLocal _ | TField (_,FEnum _) | TTypeExpr _ | TFunction _ -> ()
 		| TMatch _ | TNew _ | TCall _ | TField _ | TArray _ | TBinop ((OpAssignOp _ | OpAssign),_,_) | TUnop ((Increment|Decrement),_,_) -> raise Exit
 		| TReturn _ | TBreak | TContinue | TThrow _ | TCast (_,Some _) -> raise Exit
 		| TCast (_,None) | TBinop _ | TUnop _ | TParenthesis _ | TWhile _ | TFor _ | TIf _ | TTry _ | TSwitch _ | TArrayDecl _ | TVars _ | TBlock _ | TObjectDecl _ -> Type.iter loop e
@@ -39,12 +39,10 @@ let has_side_effect e =
 
 let api_inline ctx c field params p =
 	match c.cl_path, field, params with
-	| ([],"Type"),"enumIndex",[{ eexpr = TEnumField (en,f) }] ->
-		let c = (try PMap.find f en.e_constrs with Not_found -> assert false) in
-		Some (mk (TConst (TInt (Int32.of_int c.ef_index))) ctx.t.tint p)
-	| ([],"Type"),"enumIndex",[{ eexpr = TCall({ eexpr = TEnumField (en,f) },pl) }] when List.for_all (fun e -> not (has_side_effect e)) pl ->
-		let c = (try PMap.find f en.e_constrs with Not_found -> assert false) in
-		Some (mk (TConst (TInt (Int32.of_int c.ef_index))) ctx.t.tint p)
+	| ([],"Type"),"enumIndex",[{ eexpr = TField (_,FEnum (en,f)) }] ->
+		Some (mk (TConst (TInt (Int32.of_int f.ef_index))) ctx.t.tint p)
+	| ([],"Type"),"enumIndex",[{ eexpr = TCall({ eexpr = TField (_,FEnum (en,f)) },pl) }] when List.for_all (fun e -> not (has_side_effect e)) pl ->
+		Some (mk (TConst (TInt (Int32.of_int f.ef_index))) ctx.t.tint p)
 	| ([],"Std"),"int",[{ eexpr = TConst (TInt _) } as e] ->
 		Some { e with epos = p }
 	| ([],"String"),"fromCharCode",[{ eexpr = TConst (TInt i) }] when i > 0l && i < 128l ->
@@ -309,7 +307,7 @@ let rec type_inline ctx cf f ethis params tret p force =
 			| TLocal _
 			| TConst TThis (* not really, but should not be move inside a function body *)
 				-> raise Exit
-			| TEnumField _
+			| TField (_,FEnum _)
 			| TTypeExpr _
 			| TConst _ -> ()
 			| _ ->
@@ -543,7 +541,7 @@ let standard_precedence op =
 
 let rec need_parent e =
 	match e.eexpr with
-	| TConst _ | TLocal _ | TEnumField _ | TArray _ | TField _ | TParenthesis _ | TCall _ | TNew _ | TTypeExpr _ | TObjectDecl _ | TArrayDecl _ -> false
+	| TConst _ | TLocal _ | TArray _ | TField _ | TParenthesis _ | TCall _ | TNew _ | TTypeExpr _ | TObjectDecl _ | TArrayDecl _ -> false
 	| TCast (e,None) -> need_parent e
 	| TCast _ | TThrow _ | TReturn _ | TTry _ | TMatch _ | TSwitch _ | TFor _ | TIf _ | TWhile _ | TBinop _ | TContinue | TBreak
 	| TBlock _ | TVars _ | TFunction _ | TUnop _ -> true
@@ -687,7 +685,7 @@ let reduce_expr ctx e =
 		List.iter (fun (cl,_) ->
 			List.iter (fun e ->
 				match e.eexpr with
-				| TCall ({ eexpr = TEnumField _ },_) -> error "Not-constant enum in switch cannot be matched" e.epos
+				| TCall ({ eexpr = TField (_,FEnum _) },_) -> error "Not-constant enum in switch cannot be matched" e.epos
 				| _ -> ()
 			) cl
 		) cases;
@@ -846,12 +844,12 @@ let rec reduce_loop ctx e =
 			| OpBoolAnd when a  -> e1
 			| OpBoolOr when not a -> e1
 			| _ -> e)
-		| TEnumField (e1,f1), TEnumField (e2,f2) when e1 == e2 ->
+		| TField (_,FEnum (e1,f1)), TField (_,FEnum (e2,f2)) when e1 == e2 ->
 			(match op with
-			| OpEq -> { e with eexpr = TConst (TBool (f1 = f2)) }
-			| OpNotEq -> { e with eexpr = TConst (TBool (f1 <> f2)) }
+			| OpEq -> { e with eexpr = TConst (TBool (f1 == f2)) }
+			| OpNotEq -> { e with eexpr = TConst (TBool (f1 != f2)) }
 			| _ -> e)
-		| _, TCall ({ eexpr = TEnumField _ },_) | TCall ({ eexpr = TEnumField _ },_), _ ->
+		| _, TCall ({ eexpr = TField (_,FEnum _) },_) | TCall ({ eexpr = TField (_,FEnum _) },_), _ ->
 			(match op with
 			| OpAssign -> e
 			| _ ->

+ 2 - 7
type.ml

@@ -98,7 +98,6 @@ and tanon = {
 and texpr_expr =
 	| TConst of tconstant
 	| TLocal of tvar
-	| TEnumField of tenum * string
 	| TArray of texpr * texpr
 	| TBinop of Ast.binop * texpr * texpr
 	| TField of texpr * tfield_access
@@ -130,6 +129,7 @@ and tfield_access =
 	| FAnon of tclass_field
 	| FDynamic of string
 	| FClosure of tclass option * tclass_field (* None class = TAnon *)
+	| FEnum of tenum * tenum_field
 
 and texpr = {
 	eexpr : texpr_expr;
@@ -308,6 +308,7 @@ let fun_args l = List.map (fun (a,c,t) -> a, c <> None, t) l
 let field_name f =
 	match f with
 	| FAnon f | FInstance (_,f) | FStatic (_,f) | FClosure (_,f) -> f.cf_name
+	| FEnum (_,f) -> f.ef_name
 	| FDynamic n -> n
 
 let mk_class m path pos =
@@ -1177,7 +1178,6 @@ let iter f e =
 	match e.eexpr with
 	| TConst _
 	| TLocal _
-	| TEnumField _
 	| TBreak
 	| TContinue
 	| TTypeExpr _ ->
@@ -1229,7 +1229,6 @@ let map_expr f e =
 	match e.eexpr with
 	| TConst _
 	| TLocal _
-	| TEnumField _
 	| TBreak
 	| TContinue
 	| TTypeExpr _ ->
@@ -1280,7 +1279,6 @@ let map_expr f e =
 let map_expr_type f ft fv e =
 	match e.eexpr with
 	| TConst _
-	| TEnumField _
 	| TBreak
 	| TContinue
 	| TTypeExpr _ ->
@@ -1349,7 +1347,6 @@ let s_expr_kind e =
 	match e.eexpr with
 	| TConst _ -> "Const"
 	| TLocal _ -> "Local"
-	| TEnumField _ -> "EnumField"
 	| TArray (_,_) -> "Array"
 	| TBinop (_,_,_) -> "Binop"
 	| TField (_,_) -> "Field"
@@ -1394,8 +1391,6 @@ let rec s_expr s_type e =
 		"Const " ^ s_const c
 	| TLocal v ->
 		"Local " ^ s_var v
-	| TEnumField (e,f) ->
-		sprintf "EnumField %s.%s" (s_type_path e.e_path) f
 	| TArray (e1,e2) ->
 		sprintf "%s[%s]" (loop e1) (loop e2)
 	| TBinop (op,e1,e2) ->

+ 15 - 10
typer.ml

@@ -448,6 +448,10 @@ let rec unify_call_params ctx cf el args r p inline =
 	in
 	loop [] el args []
 
+let fast_enum_field e ef p =
+	let et = mk (TTypeExpr (TEnumDecl e)) (TAnon { a_fields = PMap.empty; a_status = ref (EnumStatics e) }) p in
+	TField (et,FEnum (e,ef))
+	
 let rec type_module_type ctx t tparams p =
 	match t with
 	| TClassDecl c ->
@@ -633,8 +637,10 @@ let field_access ctx mode f fmode t e p =
 		match follow e.etype with
 		| TAnon a ->
 			(match !(a.a_status) with
-			| EnumStatics e ->
-				AKField ((mk (TEnumField (e,f.cf_name)) t p),f, fmode)
+			| EnumStatics en ->
+				let c = (try PMap.find f.cf_name en.e_constrs with Not_found -> assert false) in
+				let fmode = FEnum (en,c) in
+				AKField ((mk (TField (e,fmode)) t p),f, fmode)
 			| _ -> fnormal())
 		| _ -> fnormal()
 	in
@@ -648,7 +654,7 @@ let field_access ctx mode f fmode t e p =
 		| _ , MGet ->
 			let cmode = (match fmode with
 				| FInstance (c,cf) -> FClosure (Some c,cf)
-				| FStatic _ -> fmode
+				| FStatic _ | FEnum _ -> fmode
 				| FAnon f -> FClosure (None, f)
 				| FDynamic _ | FClosure _ -> assert false
 			) in
@@ -847,7 +853,8 @@ let rec type_ident_raise ?(imported_enums=true) ctx i p mode =
 				| TEnumDecl e ->
 					try
 						let ef = PMap.find i e.e_constrs in
-						mk (TEnumField (e,i)) (monomorphs ef.ef_params (monomorphs e.e_types ef.ef_type)) p
+						let et = type_module_type ctx t None p in
+						mk (TField (et,FEnum (e,ef))) (monomorphs ef.ef_params (monomorphs e.e_types ef.ef_type)) p
 					with
 						Not_found -> loop l
 		in
@@ -1478,7 +1485,7 @@ and type_switch_old ctx e cases def need_val with_type p =
 					display_error ctx ("This constructor is not part of the enum " ^ s_type_path en.e_path) p;
 					raise Exit
 				) in
-				mk (TEnumField (en,i)) (apply_params en.e_types params ef.ef_type) (snd e)
+				mk (fast_enum_field en ef p) (apply_params en.e_types params ef.ef_type) (snd e)
 			| _ ->
 				type_expr ctx e
 			) in
@@ -1489,7 +1496,7 @@ and type_switch_old ctx e cases def need_val with_type p =
 				| _ -> raise Exit
 			) pl in
 			(match e.eexpr with
-			| TEnumField (en,s) -> type_match e en s pl
+			| TField (_,FEnum (en,c)) -> type_match e en c.ef_name pl
 			| _ -> if pl = [] then case_expr e else raise Exit)
 		with Exit ->
 			case_expr (type_expr ctx efull)
@@ -1670,7 +1677,7 @@ and type_expr_with_type_raise ?(print_error=true) ctx e t =
 			with Not_found -> try
 				let ef = PMap.find s e.e_constrs in
 				let et = apply_params e.e_types pl (monomorphs ef.ef_params ef.ef_type) in
-				let constr = mk (TEnumField (e,s)) et p in
+				let constr = mk (fast_enum_field e ef p) et p in
 				build_call ctx (AKExpr constr) el (Some t) p
 			with Not_found ->
 				if ctx.untyped then raise Exit; (* __js__, etc. *)
@@ -1731,7 +1738,7 @@ and type_expr_with_type_raise ?(print_error=true) ctx e t =
 				| TEnum (e,pl) ->
 					(try
 						let ef = PMap.find s e.e_constrs in
-						mk (TEnumField (e,s)) (apply_params e.e_types pl ef.ef_type) p
+						mk (fast_enum_field e ef p) (apply_params e.e_types pl ef.ef_type) p
 					with Not_found ->
 						error ("Identifier '" ^ s ^ "' is not part of enum " ^ s_type_path e.e_path) p;
 						mk (TConst TNull) t p)
@@ -2796,8 +2803,6 @@ let generate ctx =
 			| TEnumDecl e -> loop_enum p e
 			| TAbstractDecl a -> loop_abstract p a
 			| TTypeDecl _ -> assert false)
-		| TEnumField (e,_) ->
-			loop_enum p e
 		| TNew (c,_,_) ->
 			iter (walk_expr p) e;
 			loop_class p c;