Просмотр исходного кода

[warnings] use -w instead of defines (#12013)

* Always check var shadowing, disable associated warning by default

* Deprecate some warnings related defines
Rudy Ges 5 месяцев назад
Родитель
Сommit
a22f41f56d
3 измененных файлов с 7 добавлено и 4 удалено
  1. 4 2
      src-json/define.json
  2. 2 1
      src-json/warning.json
  3. 1 1
      src/context/typecore.ml

+ 4 - 2
src-json/define.json

@@ -503,7 +503,8 @@
 	{
 	{
 		"name": "NoDeprecationWarnings",
 		"name": "NoDeprecationWarnings",
 		"define": "no-deprecation-warnings",
 		"define": "no-deprecation-warnings",
-		"doc": "Do not warn if fields annotated with `@:deprecated` are used."
+		"doc": "Do not warn if fields annotated with `@:deprecated` are used.",
+		"deprecated": "Use -w to configure warnings. See https://haxe.org/manual/cr-warnings.html for more information."
 	},
 	},
 	{
 	{
 		"name": "NoFlashOverride",
 		"name": "NoFlashOverride",
@@ -758,7 +759,8 @@
 	{
 	{
 		"name": "WarnVarShadowing",
 		"name": "WarnVarShadowing",
 		"define": "warn-var-shadowing",
 		"define": "warn-var-shadowing",
-		"doc": "Warn about shadowing variable declarations."
+		"doc": "Warn about shadowing variable declarations.",
+		"deprecated": "Use -w to configure warnings. See https://haxe.org/manual/cr-warnings.html for more information."
 	},
 	},
 	{
 	{
 		"name": "NoTre",
 		"name": "NoTre",

+ 2 - 1
src-json/warning.json

@@ -76,7 +76,8 @@
 	{
 	{
 		"name": "WVarShadow",
 		"name": "WVarShadow",
 		"doc": "A local variable hides another by using the same name",
 		"doc": "A local variable hides another by using the same name",
-		"parent": "WTyper"
+		"parent": "WTyper",
+		"enabled": false
 	},
 	},
 	{
 	{
 		"name": "WExternWithExpr",
 		"name": "WExternWithExpr",

+ 1 - 1
src/context/typecore.ml

@@ -288,7 +288,7 @@ let save_locals ctx =
 
 
 let add_local ctx k n t p =
 let add_local ctx k n t p =
 	let v = alloc_var k n t p in
 	let v = alloc_var k n t p in
-	if Define.defined ctx.com.defines Define.WarnVarShadowing && n <> "_" then begin
+	if n <> "_" then begin
 		match k with
 		match k with
 		| VUser _ ->
 		| VUser _ ->
 			begin try
 			begin try