summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compiler.c1
-rw-r--r--tests/custom/03_bugs/20_use_strict_stack_mismatch17
2 files changed, 17 insertions, 1 deletions
diff --git a/compiler.c b/compiler.c
index bbd6dbc..00079fd 100644
--- a/compiler.c
+++ b/compiler.c
@@ -1374,7 +1374,6 @@ uc_compiler_compile_constant(uc_compiler *compiler, bool assignable)
if (uc_compiler_is_use_strict_pragma(compiler)) {
fn = (uc_function_t *)compiler->function;
fn->strict = true;
- break;
}
/* fall through */
diff --git a/tests/custom/03_bugs/20_use_strict_stack_mismatch b/tests/custom/03_bugs/20_use_strict_stack_mismatch
new file mode 100644
index 0000000..7294d23
--- /dev/null
+++ b/tests/custom/03_bugs/20_use_strict_stack_mismatch
@@ -0,0 +1,17 @@
+When compiling the `use strict` statement, the compiler omitted the
+corresponding load instruction, leading to a mismatch of the expected
+stack layout between compiler and VM.
+
+-- Expect stdout --
+1
+-- End --
+
+-- Testcase --
+{%
+ "use strict";
+
+ let x = 1;
+
+ print(x, "\n");
+%}
+-- End --