浏览代码

make warn-var-shadowing a proper define

Dan Korostelev 7 年之前
父节点
当前提交
8d24ffdbed
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      src/context/typecore.ml
  2. 2 0
      src/core/define.ml

+ 1 - 1
src/context/typecore.ml

@@ -207,7 +207,7 @@ let save_locals ctx =
 
 let add_local ctx n t p =
 	let v = alloc_var n t p in
-	if Define.raw_defined ctx.com.defines "warn-var-shadowing" then begin
+	if Define.defined ctx.com.defines WarnVarShadowing then begin
 		try
 			let v' = PMap.find n ctx.locals in
 			ctx.com.warning "This variable shadows a previously declared variable" p;

+ 2 - 0
src/core/define.ml

@@ -108,6 +108,7 @@ type strict_defined =
 	| UseNekoc
 	| UseRttiDoc
 	| Vcproj
+	| WarnVarShadowing
 	| NoMacroCache
 	| Last (* must be last *)
 
@@ -221,6 +222,7 @@ let infos = function
 	| UseNekoc -> "use_nekoc",("Use nekoc compiler instead of internal one",[Platform Neko])
 	| UseRttiDoc -> "use_rtti_doc",("Allows access to documentation during compilation",[])
 	| Vcproj -> "vcproj",("GenCPP internal",[Platform Cpp])
+	| WarnVarShadowing -> "warn_var_shadowing",("Warn about shadowing variable declarations",[])
 	| Last -> assert false
 
 let get_documentation_list() =