summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom/03_bugs')
-rw-r--r--tests/custom/03_bugs/24_compiler_local_for_loop_declaration18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/custom/03_bugs/24_compiler_local_for_loop_declaration b/tests/custom/03_bugs/24_compiler_local_for_loop_declaration
new file mode 100644
index 0000000..aafde55
--- /dev/null
+++ b/tests/custom/03_bugs/24_compiler_local_for_loop_declaration
@@ -0,0 +1,18 @@
+When compiling a for-loop local variable initializer expression, the compiler
+incorrectly treated subsequent declarations as global variable assignments,
+triggering reference error exceptions in strict mode.
+
+-- Expect stdout --
+1
+-- End --
+
+-- Testcase --
+{%
+ "use strict";
+
+ // The initializer expression below was incorrectly interpreted as
+ // `let x = 0; y = 1` instead of the correct `let ..., y = 1`.
+ for (let x = 0, y = 1; x < 1; x++)
+ print(y, "\n");
+%}
+-- End --