diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-05-04 16:32:32 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-05-04 16:32:32 +0200 |
commit | 16604331c185d7597b53709cc09a072a2652415e (patch) | |
tree | 175777b9c4ac0ee49fd1b9de01527e3063d26d91 | |
parent | 799c9f4dbe123536e1dde1639a122f48dcf75a05 (diff) |
compiler: fix stack mismatch on compiling `use strict` statements
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | compiler.c | 1 | ||||
-rw-r--r-- | tests/custom/03_bugs/20_use_strict_stack_mismatch | 17 |
2 files changed, 17 insertions, 1 deletions
@@ -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 -- |