Browse Source

[analyzer] fix stack overflow on empty TBlock

see #11393
Simon Krajewski 1 year ago
parent
commit
aff9061868

+ 1 - 0
src/optimization/analyzerTexpr.ml

@@ -62,6 +62,7 @@ let map_values ?(allow_control_flow=true) f e =
 				let e = {e with eexpr = TBlock (List.rev (e1 :: el))} in
 				{e with eexpr = TMeta((Meta.MergeBlock,[],e.epos),e)}
 			| [] ->
+				if not complex then raise Exit;
 				f e
 			end
 		| TTry(e1,catches) ->

+ 3 - 0
tests/misc/projects/Issue11396/Main.hx

@@ -0,0 +1,3 @@
+function main() {
+	[var tmp];
+}

+ 2 - 0
tests/misc/projects/Issue11396/compile-fail.hxml

@@ -0,0 +1,2 @@
+--main Main
+--interp

+ 1 - 0
tests/misc/projects/Issue11396/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:2: characters 3-6 : Cannot use Void as value