فهرست منبع

hide some deprecation warnings behind hx3compat

see #6982
Simon Krajewski 7 سال پیش
والد
کامیت
632cef8f3f
2فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 3 1
      src/core/define.ml
  2. 4 2
      src/typing/typeloadFields.ml

+ 3 - 1
src/core/define.ml

@@ -290,4 +290,6 @@ let get_signature def =
 		let str = String.concat "@" (List.sort compare defines) in
 		let s = Digest.string str in
 		def.defines_signature <- Some s;
-		s
+		s
+
+let is_haxe3_compat def = raw_defined def "hx3compat"

+ 4 - 2
src/typing/typeloadFields.ml

@@ -324,7 +324,8 @@ let build_module_def ctx mt meta fvars context_init fbuild =
 		| Meta.Enum,_,p -> f_build,Some (fun () ->
 				begin match mt with
 					| TClassDecl ({cl_kind = KAbstractImpl a} as c) ->
-						if p <> null_pos then ctx.com.warning "`@:enum abstract` is deprecated in favor of `enum abstract`" p;
+						if p <> null_pos && not (Define.is_haxe3_compat ctx.com.defines) then
+							ctx.com.warning "`@:enum abstract` is deprecated in favor of `enum abstract`" p;
 						context_init();
 						let e = build_enum_abstract ctx c a (fvars()) p in
 						fbuild e;
@@ -399,7 +400,8 @@ let create_field_context (ctx,cctx) c cff =
 	let is_static = List.mem AStatic cff.cff_access in
 	let is_extern = List.mem AExtern cff.cff_access in
 	let is_extern = if Meta.has Meta.Extern cff.cff_meta then begin
-		ctx.com.warning "`@:extern function` is deprecated in favor of `extern function`" (pos cff.cff_name);
+		if not (Define.is_haxe3_compat ctx.com.defines) then
+			ctx.com.warning "`@:extern` on fields is deprecated in favor of `extern`" (pos cff.cff_name);
 		true
 	end else
 		is_extern