2
0
Эх сурвалжийг харах

[typer] replace Meta.Impl with CfImpl

Simon Krajewski 5 жил өмнө
parent
commit
b16cd4516f

+ 0 - 7
src-json/meta.json

@@ -520,13 +520,6 @@
 		"targets": ["TClassField"],
 		"links": ["https://haxe.org/manual/cr-dce.html"]
 	},
-	{
-		"name": "Impl",
-		"metadata": ":impl",
-		"doc": "Used internally to mark abstract implementation fields.",
-		"targets": ["TAbstractField"],
-		"internal": true
-	},
 	{
 		"name": "PythonImport",
 		"metadata": ":pythonImport",

+ 1 - 1
src/codegen/gencommon/abstractImplementationFix.ml

@@ -26,7 +26,7 @@ let add_abstract_params = function
 			function
 			| ({ cf_name = "_new" } as cf) ->
 				cf.cf_params <- cf.cf_params @ a.a_params
-			| cf when Meta.has Meta.Impl cf.cf_meta ->
+			| cf when has_class_field_flag cf CfImpl ->
 				(match cf.cf_expr with
 				| Some({ eexpr = TFunction({ tf_args = (v, _) :: _ }) }) when Meta.has Meta.This v.v_meta ->
 					cf.cf_params <- cf.cf_params @ a.a_params

+ 1 - 1
src/context/abstractCast.ml

@@ -125,7 +125,7 @@ let find_array_access_raise ctx a pl e1 e2o p =
 				) monos cf.cf_params;
 			in
 			let get_ta() =
-				if has_meta Meta.Impl cf.cf_meta then ta
+				if has_class_field_flag cf CfImpl then ta
 				else TAbstract(a,pl)
 			in
 			match follow (map cf.cf_type) with

+ 1 - 1
src/context/display/displayEmitter.ml

@@ -115,7 +115,7 @@ let display_field ctx origin scope cf p = match ctx.com.display.dms_kind with
 		in
 		ReferencePosition.set (name,cf.cf_name_pos,kind)
 	| DMHover ->
-		let cf = if Meta.has Meta.Impl cf.cf_meta then
+		let cf = if has_class_field_flag cf CfImpl then
 			prepare_using_field cf
 		else
 			cf

+ 4 - 4
src/context/display/displayFields.ml

@@ -51,7 +51,7 @@ let collect_static_extensions ctx items e p =
 		| (c,_) :: l ->
 			let rec dup t = Type.map dup t in
 			let acc = List.fold_left (fun acc f ->
-				if Meta.has Meta.NoUsing f.cf_meta || Meta.has Meta.NoCompletion f.cf_meta || Meta.has Meta.Impl f.cf_meta || PMap.mem f.cf_name acc then
+				if Meta.has Meta.NoUsing f.cf_meta || Meta.has Meta.NoCompletion f.cf_meta || has_class_field_flag f CfImpl || PMap.mem f.cf_name acc then
 					acc
 				else begin
 					let f = { f with cf_type = opt_type f.cf_type } in
@@ -112,7 +112,7 @@ let collect ctx e_ast e dk with_type p =
 			| "get_" | "set_" -> false
 			| _ -> can_access ctx c cf stat
 		end else
-			(not stat || not (Meta.has Meta.Impl cf.cf_meta)) &&
+			(not stat || not (has_class_field_flag cf CfImpl)) &&
 			can_access ctx c cf stat
 	in
 	let make_class_field origin cf =
@@ -171,7 +171,7 @@ let collect ctx e_ast e dk with_type p =
 			Display.merge_core_doc ctx (TAbstractDecl a);
 			(* Abstracts should show all their @:impl fields minus the constructor. *)
 			let items = List.fold_left (fun acc cf ->
-				if Meta.has Meta.Impl cf.cf_meta && not (Meta.has Meta.Enum cf.cf_meta) && should_access c cf false && is_new_item acc cf.cf_name then begin
+				if has_class_field_flag cf CfImpl && not (Meta.has Meta.Enum cf.cf_meta) && should_access c cf false && is_new_item acc cf.cf_name then begin
 					let origin = Self(TAbstractDecl a) in
 					let cf = prepare_using_field cf in
 					let cf = if tl = [] then cf else {cf with cf_type = apply_params a.a_params tl cf.cf_type} in
@@ -225,7 +225,7 @@ let collect ctx e_ast e dk with_type p =
 				if is_new_item acc name then begin
 					let allow_static_abstract_access c cf =
 						should_access c cf false &&
-						(not (Meta.has Meta.Impl cf.cf_meta) || Meta.has Meta.Enum cf.cf_meta)
+						(not (has_class_field_flag cf CfImpl) || Meta.has Meta.Enum cf.cf_meta)
 					in
 					let ct = CompletionType.from_type (get_import_status ctx) ~values:(get_value_meta cf.cf_meta) cf.cf_type in
 					let add origin make_field =

+ 1 - 1
src/context/display/displayToplevel.ml

@@ -324,7 +324,7 @@ let collect ctx tk with_type sort =
 		| KAbstractImpl ({a_impl = Some c} as a) ->
 			let origin = Self (TAbstractDecl a) in
 			List.iter (fun cf ->
-				if Meta.has Meta.Impl cf.cf_meta then begin
+				if has_class_field_flag cf CfImpl then begin
 					if ctx.curfun = FunStatic then ()
 					else begin
 						let cf = prepare_using_field cf in

+ 1 - 0
src/core/tType.ml

@@ -392,6 +392,7 @@ type flag_tclass_field =
 	| CfOverride
 	| CfAbstract
 	| CfOverload
+	| CfImpl
 
 type flag_tvar =
 	| VCaptured

+ 1 - 1
src/filters/tre.ml

@@ -99,7 +99,7 @@ let is_recursive_named_local_call fn_var callee args =
 let is_recursive_method_call cls field callee args =
 	match callee.eexpr, args with
 	(* member abstract function*)
-	| TField (_, FStatic (_, cf)), { eexpr = TLocal v } :: _ when has_meta Meta.Impl cf.cf_meta ->
+	| TField (_, FStatic (_, cf)), { eexpr = TLocal v } :: _ when has_class_field_flag cf CfImpl ->
 		cf == field && has_meta Meta.This v.v_meta
 	(* static method *)
 	| TField (_, FStatic (_, cf)), _ ->

+ 2 - 2
src/generators/genhxold.ml

@@ -142,7 +142,7 @@ let generate_type com t =
 	let print_meta ml =
 		List.iter (fun (m,pl,_) ->
 			match m with
-			| Meta.DefParam | Meta.CoreApi | Meta.Used | Meta.MaybeUsed | Meta.FlatEnum | Meta.Value | Meta.DirectlyUsed | Meta.Enum | Meta.Impl -> ()
+			| Meta.DefParam | Meta.CoreApi | Meta.Used | Meta.MaybeUsed | Meta.FlatEnum | Meta.Value | Meta.DirectlyUsed | Meta.Enum -> ()
 			| _ ->
 			match pl with
 			| [] -> p "@%s " (Meta.to_string m)
@@ -288,7 +288,7 @@ let generate_type com t =
 			in
 
 			List.iter (fun f ->
-				let static = not (Meta.has Meta.Impl f.cf_meta) in
+				let static = not (has_class_field_flag f CfImpl) in
 				if not static && is_enum && Meta.has Meta.Enum f.cf_meta then begin
 					p "\tvar %s;\n" f.cf_name;
 				end else

+ 2 - 2
src/generators/genpy.ml

@@ -1636,8 +1636,8 @@ module Printer = struct
 			in
 			let prefix = match e1.eexpr, follow x.etype with
 				(* the should not apply for the instance methods of the abstract itself *)
-				| TField(_, FStatic({cl_path = ["python"; "_KwArgs"],"KwArgs_Impl_"},f)), _ when i == 0 && Meta.has Meta.Impl f.cf_meta -> ""
-				| TField(_, FStatic({cl_path = ["python"; "_VarArgs"],"VarArgs_Impl_"},f)), _ when i == 0 && Meta.has Meta.Impl f.cf_meta -> ""
+				| TField(_, FStatic({cl_path = ["python"; "_KwArgs"],"KwArgs_Impl_"},f)), _ when i == 0 && has_class_field_flag f CfImpl -> ""
+				| TField(_, FStatic({cl_path = ["python"; "_VarArgs"],"VarArgs_Impl_"},f)), _ when i == 0 && has_class_field_flag f CfImpl -> ""
 				| _, TAbstract({a_path = ["python"],"KwArgs"},_) -> "**"
 				| _, TAbstract({a_path = ["python"],"VarArgs"},_) -> "*"
 				| _, _ -> ""

+ 2 - 2
src/optimization/inline.ml

@@ -250,7 +250,7 @@ let inline_default_config cf t =
 
 let inline_config cls_opt cf call_args return_type =
 	match cls_opt with
-	| Some ({cl_kind = KAbstractImpl _}) when Meta.has Meta.Impl cf.cf_meta ->
+	| Some ({cl_kind = KAbstractImpl _}) when has_class_field_flag cf CfImpl ->
 		let t = if cf.cf_name = "_new" then
 			return_type
 		else if call_args = [] then
@@ -587,7 +587,7 @@ class inline_state ctx ethis params cf f p = object(self)
 			let unify_func () = unify_raise ctx mt (TFun (tl,tret)) p in
 			(match follow ethis.etype with
 			| TAnon a -> (match !(a.a_status) with
-				| Statics {cl_kind = KAbstractImpl a } when Meta.has Meta.Impl cf.cf_meta ->
+				| Statics {cl_kind = KAbstractImpl a } when has_class_field_flag cf CfImpl ->
 					if cf.cf_name <> "_new" then begin
 						(* the first argument must unify with a_this for abstract implementation functions *)
 						let tb = (TFun(("",false,map_type a.a_this) :: (List.tl tl),tret)) in

+ 1 - 1
src/typing/calls.ml

@@ -486,7 +486,7 @@ let type_generic_function ctx fa el_typed el with_type p =
 		error msg p)
 
 let abstract_using_param_type sea = match follow sea.se_this.etype with
-	| TAbstract(a,tl) when Meta.has Meta.Impl sea.se_access.fa_field.cf_meta -> apply_params a.a_params tl a.a_this
+	| TAbstract(a,tl) when has_class_field_flag sea.se_access.fa_field CfImpl -> apply_params a.a_params tl a.a_this
 	| _ -> sea.se_this.etype
 
 class call_dispatcher

+ 3 - 3
src/typing/fields.ml

@@ -265,7 +265,7 @@ let rec using_field ctx mode e i p =
 	| (c,pc) :: l ->
 		try
 			let cf = PMap.find i c.cl_statics in
-			if Meta.has Meta.NoUsing cf.cf_meta || not (can_access ctx c cf true) || (Meta.has Meta.Impl cf.cf_meta) then raise Not_found;
+			if Meta.has Meta.NoUsing cf.cf_meta || not (can_access ctx c cf true) || (has_class_field_flag cf CfImpl) then raise Not_found;
 			let monos = Monomorph.spawn_constrained_monos (fun t -> t) cf.cf_params in
 			let map = apply_params cf.cf_params monos in
 			let t = map cf.cf_type in
@@ -411,7 +411,7 @@ let rec type_field cfg ctx e i p mode (with_type : WithType.t) =
 	| TAnon a ->
 		(try
 			let f = PMap.find i a.a_fields in
-			if Meta.has Meta.Impl f.cf_meta && not (Meta.has Meta.Enum f.cf_meta) then display_error ctx "Cannot access non-static abstract field statically" pfield;
+			if has_class_field_flag f CfImpl && not (Meta.has Meta.Enum f.cf_meta) then display_error ctx "Cannot access non-static abstract field statically" pfield;
 			begin match mode with
 			| MCall _ when has_class_field_flag f CfOverload ->
 				()
@@ -506,7 +506,7 @@ let rec type_field cfg ctx e i p mode (with_type : WithType.t) =
 		(try
 			let c = (match a.a_impl with None -> raise Not_found | Some c -> c) in
 			let f = PMap.find i c.cl_statics in
-			if not (Meta.has Meta.Impl f.cf_meta) then begin
+			if not (has_class_field_flag f CfImpl) then begin
 				static_abstract_access_through_instance := true;
 				raise Not_found;
 			end;

+ 3 - 3
src/typing/matcher.ml

@@ -296,7 +296,7 @@ module Pattern = struct
 							en.e_names
 						| TAbstract({a_impl = Some c} as a,pl) when Meta.has Meta.Enum a.a_meta ->
 							ExtList.List.filter_map (fun cf ->
-								if Meta.has Meta.Impl cf.cf_meta && Meta.has Meta.Enum cf.cf_meta then Some cf.cf_name else None
+								if has_class_field_flag cf CfImpl && Meta.has Meta.Enum cf.cf_meta then Some cf.cf_name else None
 							) c.cl_ordered_statics
 						| _ ->
 							[]
@@ -441,7 +441,7 @@ module Pattern = struct
 							) in
 							collect_fields (Abstract.get_underlying_type a tl) filter);
 						List.iter (fun cf ->
-							if Meta.has Meta.Impl cf.cf_meta then
+							if has_class_field_flag cf CfImpl then
 								collect_field cf (apply_params a.a_params tl cf.cf_type) filter
 						) c.cl_ordered_statics;
 					| _ ->
@@ -1384,7 +1384,7 @@ module TexprConverter = struct
 			| TAbstract({a_impl = Some c} as a,pl) when Meta.has Meta.Enum a.a_meta ->
 				List.iter (fun cf ->
 					ignore(follow cf.cf_type);
-					if Meta.has Meta.Impl cf.cf_meta && Meta.has Meta.Enum cf.cf_meta then match cf.cf_expr with
+					if has_class_field_flag cf CfImpl && Meta.has Meta.Enum cf.cf_meta then match cf.cf_expr with
 						| Some e ->
 							begin match extract_const e with
 							| Some ct -> if ct <> TNull then add (ConConst ct,null_pos)

+ 16 - 19
src/typing/typeloadFields.ml

@@ -224,14 +224,14 @@ let transform_abstract_field com this_t a_t a f =
 	let p = f.cff_pos in
 	match f.cff_kind with
 	| FProp ((("get" | "never"),_),(("set" | "never"),_),_,_) when not stat ->
-		{ f with cff_access = (AStatic,null_pos) :: f.cff_access; cff_meta = (Meta.Impl,[],null_pos) :: f.cff_meta }
-	| FProp _ when not stat ->
+		f
+	| FProp _ when not stat && not (Meta.has Meta.Enum f.cff_meta) ->
 		error "Member property accessors must be get/set or never" p;
 	| FFun fu when fst f.cff_name = "new" && not stat ->
 		let init p = (EVars [mk_evar ~t:this_t ("this",null_pos)],p) in
 		let cast e = (ECast(e,None)),pos e in
 		let ret p = (EReturn (Some (cast (EConst (Ident "this"),p))),p) in
-		let meta = (Meta.Impl,[],null_pos) :: (Meta.NoCompletion,[],null_pos) :: f.cff_meta in
+		let meta = (Meta.NoCompletion,[],null_pos) :: f.cff_meta in
 		if Meta.has Meta.MultiType a.a_meta then begin
 			if List.mem_assoc AInline f.cff_access then error "MultiType constructors cannot be inline" f.cff_pos;
 			if fu.f_expr <> None then error "MultiType constructors cannot have a body" f.cff_pos;
@@ -252,10 +252,10 @@ let transform_abstract_field com this_t a_t a f =
 			);
 			f_type = Some a_t;
 		} in
-		{ f with cff_name = "_new",pos f.cff_name; cff_access = (AStatic,null_pos) :: f.cff_access; cff_kind = FFun fu; cff_meta = meta }
+		{ f with cff_name = "_new",pos f.cff_name; cff_kind = FFun fu; cff_meta = meta }
 	| FFun fu when not stat ->
 		if Meta.has Meta.From f.cff_meta then error "@:from cast functions must be static" f.cff_pos;
-		{ f with cff_kind = FFun fu; cff_access = (AStatic,null_pos) :: f.cff_access; cff_meta = (Meta.Impl,[],null_pos) :: f.cff_meta }
+		{ f with cff_kind = FFun fu }
 	| _ ->
 		f
 
@@ -382,8 +382,8 @@ let build_enum_abstract ctx c a fields p =
 					visibility
 			in
 			let visibility = loop VUnknown field.cff_access in
-			field.cff_access <- [AStatic,null_pos; match visibility with VPublic acc | VPrivate acc -> acc | VUnknown -> (APublic,null_pos)];
-			field.cff_meta <- (Meta.Enum,[],null_pos) :: (Meta.Impl,[],null_pos) :: field.cff_meta;
+			field.cff_access <- [match visibility with VPublic acc | VPrivate acc -> acc | VUnknown -> (APublic,null_pos)];
+			field.cff_meta <- (Meta.Enum,[],null_pos) :: field.cff_meta;
 			let ct = match ct with
 				| Some _ -> ct
 				| None -> Some (TExprToExpr.convert_type (TAbstract(a,List.map snd a.a_params)),null_pos)
@@ -559,6 +559,7 @@ let create_field_context (ctx,cctx) c cff =
 	} in
 	let display_modifier = Typeload.check_field_access ctx cff in
 	let is_static = List.mem_assoc AStatic cff.cff_access in
+	let is_static,is_abstract_member = if cctx.abstract <> None && not is_static then true,true else is_static,false in
 	let is_extern = ref (List.mem_assoc AExtern cff.cff_access) in
 	let is_abstract = List.mem_assoc AAbstract cff.cff_access in
 	let is_final = ref (List.mem_assoc AFinal cff.cff_access) in
@@ -609,7 +610,7 @@ let create_field_context (ctx,cctx) c cff =
 		is_display_field = ctx.is_display_file && DisplayPosition.display_position#enclosed_in cff.cff_pos;
 		is_field_debug = cctx.is_class_debug || Meta.has (Meta.Custom ":debug.typeload") cff.cff_meta;
 		display_modifier = display_modifier;
-		is_abstract_member = cctx.abstract <> None && Meta.has Meta.Impl cff.cff_meta;
+		is_abstract_member = is_abstract_member;
 		field_kind = field_kind;
 		do_bind = (((not ((has_class_flag c CExtern) || !is_extern) || is_inline) && not is_abstract && not (has_class_flag c CInterface)) || field_kind = FKInit);
 		do_add = true;
@@ -729,7 +730,7 @@ let check_field_display ctx fctx c cf =
 	if fctx.is_display_field then begin
 		let scope, cf = match c.cl_kind with
 			| KAbstractImpl _ ->
-				if Meta.has Meta.Impl cf.cf_meta then
+				if has_class_field_flag cf CfImpl then
 					(if cf.cf_name = "_new" then
 						CFSConstructor, {cf with cf_name = "new"}
 					else
@@ -907,6 +908,7 @@ let create_variable (ctx,cctx,fctx) c f t eo p =
 	} in
 	if fctx.is_final then add_class_field_flag cf CfFinal;
 	if fctx.is_extern then add_class_field_flag cf CfExtern;
+	if fctx.is_abstract_member then add_class_field_flag cf CfImpl;
 	ctx.curfield <- cf;
 	bind_var (ctx,cctx,fctx) cf eo;
 	cf
@@ -944,7 +946,7 @@ let check_abstract (ctx,cctx,fctx) c cf fd t ret p =
 					| _ -> ()
 					);
 					(* TODO: this doesn't seem quite right... *)
-					if not (Meta.has Meta.Impl cf.cf_meta) then cf.cf_meta <- (Meta.Impl,[],null_pos) :: cf.cf_meta;
+					if not (has_class_field_flag cf CfImpl) then add_class_field_flag cf CfImpl;
 					let resolve_m args =
 						(try unify_raise ctx t (tfun (tthis :: args) m) cf.cf_pos with Error (Unify l,p) -> error (error_msg (Unify l)) p);
 						match follow m with
@@ -1004,13 +1006,6 @@ let check_abstract (ctx,cctx,fctx) c cf fd t ret p =
 					a.a_unops <- (op,flag,cf) :: a.a_unops;
 					allows_no_expr := true;
 					fctx.expr_presence_matters <- true;
-				| (Meta.Impl,_,_) :: ml when cf.cf_name <> "_new" && not fctx.is_macro ->
-					begin match follow t with
-						| TFun((_,_,t1) :: _, _) when type_iseq tthis t1 ->
-							()
-						| _ ->
-							display_error ctx ("First argument of implementation function must be " ^ (s_type (print_context()) tthis)) cf.cf_pos
-					end;
 				| ((Meta.Resolve,_,_) | (Meta.Op,[EField _,_],_)) :: _ ->
 					let targ = if fctx.is_abstract_member then tthis else ta in
 					let check_fun t1 t2 =
@@ -1147,7 +1142,7 @@ let create_method (ctx,cctx,fctx) c f fd p =
 	let args = loop fd.f_args in
 	let fargs = TypeloadFunction.convert_fargs fd in
 	let args,fargs = match cctx.abstract with
-		| Some a when Meta.has Meta.Impl f.cff_meta && fst f.cff_name <> "_new" (* TODO: this sucks *) && not fctx.is_macro ->
+		| Some a when fctx.is_abstract_member && fst f.cff_name <> "_new" (* TODO: this sucks *) && not fctx.is_macro ->
 			("this",None,a.a_this) :: args,(null_pos,[]) :: fargs
 		| _ ->
 			args,fargs
@@ -1163,6 +1158,7 @@ let create_method (ctx,cctx,fctx) c f fd p =
 	if fctx.is_final then add_class_field_flag cf CfFinal;
 	if fctx.is_extern then add_class_field_flag cf CfExtern;
 	if fctx.is_abstract then add_class_field_flag cf CfAbstract;
+	if fctx.is_abstract_member then add_class_field_flag cf CfImpl;
 	begin match fctx.overload with
 	| Some p ->
 		if ctx.com.config.pf_overload then
@@ -1297,6 +1293,7 @@ let create_property (ctx,cctx,fctx) c f (get,set,t,eo) p =
 		cf_doc = f.cff_doc;
 		cf_meta = f.cff_meta;
 	} in
+	if fctx.is_abstract_member then add_class_field_flag cf CfImpl;
 	let check_method m t is_getter =
 		if ctx.com.display.dms_error_policy = EPIgnore then () else
 		try
@@ -1324,7 +1321,7 @@ let create_property (ctx,cctx,fctx) c f (get,set,t,eo) p =
 					display_error ctx (compl_msg (f2.cf_name ^ ": Accessor method is here")) f2.cf_pos;
 				| _ -> ());
 			unify_raise ctx t2 t f2.cf_pos;
-			if (fctx.is_abstract_member && not (Meta.has Meta.Impl f2.cf_meta)) || (Meta.has Meta.Impl f2.cf_meta && not (fctx.is_abstract_member)) then
+			if (fctx.is_abstract_member && not (has_class_field_flag f2 CfImpl)) || (has_class_field_flag f2 CfImpl && not (fctx.is_abstract_member)) then
 				display_error ctx "Mixing abstract implementation and static properties/accessors is not allowed" f2.cf_pos;
 			f2.cf_meta <- List.fold_left (fun acc ((m,_,_) as meta) -> match m with
 				| Meta.Deprecated -> meta :: acc

+ 7 - 7
src/typing/typer.ml

@@ -368,9 +368,9 @@ let rec type_ident_raise ctx i p mode with_type =
 	with Not_found -> try
 		(* static variable lookup *)
 		let f = PMap.find i ctx.curclass.cl_statics in
-		let is_impl = Meta.has Meta.Impl f.cf_meta in
+		let is_impl = has_class_field_flag f CfImpl in
 		let is_enum = Meta.has Meta.Enum f.cf_meta in
-		if is_impl && not (Meta.has Meta.Impl ctx.curfield.cf_meta) && not is_enum then
+		if is_impl && not (has_class_field_flag ctx.curfield CfImpl) && not is_enum then
 			error (Printf.sprintf "Cannot access non-static field %s from static method" f.cf_name) p;
 		let e,fa = match ctx.curclass.cl_kind with
 			| KAbstractImpl a when is_impl && not is_enum ->
@@ -1057,7 +1057,7 @@ and type_binop2 ?(abstract_overload_only=false) ctx op (e1 : texpr) (e2 : Ast.ex
 			| (op_cf,cf) :: ol when op_cf <> op && (not is_assign_op || op_cf <> OpAssignOp(op)) ->
 				loop ol
 			| (op_cf,cf) :: ol ->
-				let is_impl = Meta.has Meta.Impl cf.cf_meta in
+				let is_impl = has_class_field_flag cf CfImpl in
 				begin match follow cf.cf_type with
 					| TFun([(_,_,t1);(_,_,t2)],tret) ->
 						let check e1 e2 swapped =
@@ -1126,7 +1126,7 @@ and type_binop2 ?(abstract_overload_only=false) ctx op (e1 : texpr) (e2 : Ast.ex
 			loop a.a_ops
 		else
 			let not_impl_or_is_commutative (_, cf) =
-				not (Meta.has Meta.Impl cf.cf_meta) || Meta.has Meta.Commutative cf.cf_meta
+				not (has_class_field_flag cf CfImpl) || Meta.has Meta.Commutative cf.cf_meta
 			in
 			loop (List.filter not_impl_or_is_commutative a.a_ops)
 	in
@@ -1179,7 +1179,7 @@ and type_unop ctx op flag e p =
 					| (op2,flag2,cf) :: opl when op == op2 && flag == flag2 ->
 						let m = spawn_monomorph ctx p in
 						let tcf = apply_params a.a_params pl (monomorphs cf.cf_params cf.cf_type) in
-						if Meta.has Meta.Impl cf.cf_meta then begin
+						if has_class_field_flag cf CfImpl then begin
 							if type_iseq (tfun [apply_params a.a_params pl a.a_this] m) tcf then cf,tcf,m else loop opl
 						end else
 							if type_iseq (tfun [e.etype] m) tcf then cf,tcf,m else loop opl
@@ -1287,7 +1287,7 @@ and type_unop ctx op flag e p =
 				| _ -> error "Could not resolve accessor" p
 			in
 			handle_accessor sea.se_this fa_set
-		| AKUsingField sea when (op = Decrement || op = Increment) && has_meta Meta.Impl sea.se_access.fa_field.cf_meta ->
+		| AKUsingField sea when (op = Decrement || op = Increment) && has_class_field_flag sea.se_access.fa_field CfImpl ->
 			handle_accessor sea.se_this sea.se_access
 		| AKUsingField _ ->
 			error "This kind of operation is not supported" p
@@ -2540,7 +2540,7 @@ and type_call ?(mode=MGet) ctx e el (with_type:WithType.t) inline p =
 			| TEnum _ -> true
 			| TAbstract (a,tl) when (Meta.has Meta.Forward a.a_meta) && not (Meta.has Meta.CoreType a.a_meta) ->
 				(match a.a_impl with
-					| Some c when (PMap.exists "match" c.cl_statics) && (Meta.has Meta.Impl (PMap.find "match" c.cl_statics).cf_meta) -> false
+					| Some c when (PMap.exists "match" c.cl_statics) && (has_class_field_flag (PMap.find "match" c.cl_statics) CfImpl) -> false
 					| _ -> has_enum_match (Abstract.get_underlying_type ~return_first:true a tl))
 			| _ -> false
 		in

+ 1 - 1
src/typing/typerDisplay.ml

@@ -53,7 +53,7 @@ let completion_item_of_expr ctx e =
 			Display.merge_core_doc ctx (TClassDecl c);
 			let decl = decl_of_class c in
 			let origin = match c.cl_kind,e1.eexpr with
-				| KAbstractImpl _,_ when Meta.has Meta.Impl cf.cf_meta -> Self decl
+				| KAbstractImpl _,_ when has_class_field_flag cf CfImpl -> Self decl
 				| _,TMeta((Meta.StaticExtension,_,_),_) -> StaticExtension decl
 				| _ -> Self decl
 			in