Browse Source

[parser] Eval empty flag value as true (#8947)

Jonas Malaco 5 years ago
parent
commit
a5c455a8af

+ 1 - 1
src/syntax/parserEntry.ml

@@ -32,7 +32,7 @@ type small_type =
 	| TVersion of (version * version * version) * (version list option)
 
 let is_true = function
-	| TBool false | TNull | TFloat 0. | TString "" -> false
+	| TBool false | TNull | TFloat 0. -> false
 	| _ -> true
 
 let s_small_type v =

+ 7 - 0
tests/misc/projects/Issue8946/Main.hx

@@ -0,0 +1,7 @@
+class Main {
+	static function main() {
+		#if !EMPTY_FLAG
+		throw "Missing branch matching -D EMPTY_FLAG=";
+		#end
+	}
+}

+ 2 - 0
tests/misc/projects/Issue8946/compile.hxml

@@ -0,0 +1,2 @@
+-D EMPTY_FLAG=
+--run Main