2
0
Эх сурвалжийг харах

[eval] still push a scope for single-element blocks

Someone might declare a variable there...

closes #7499
Simon Krajewski 7 жил өмнө
parent
commit
9fabbef082

+ 4 - 1
src/macro/eval/evalJit.ml

@@ -304,7 +304,10 @@ and jit_expr jit return e =
 	| TBlock [] ->
 	| TBlock [] ->
 		emit_null
 		emit_null
 	| TBlock [e1] ->
 	| TBlock [e1] ->
-		jit_expr jit return e1
+		push_scope jit e.epos;
+		let exec = jit_expr jit return e1 in
+		pop_scope jit;
+		exec
 	| TBlock (e1 :: el) ->
 	| TBlock (e1 :: el) ->
 		let rec loop f el =
 		let rec loop f el =
 			match el with
 			match el with

+ 12 - 0
tests/unit/src/unit/issues/Issue7499.hx

@@ -0,0 +1,12 @@
+package unit.issues;
+
+class Issue7499 extends unit.Test {
+	@:analyzer(ignore)
+	function test() var a;
+
+	@:analyzer(ignore)
+	static function __init__() {
+		var s:String;
+	}
+
+}