From fd2e5589ce686d088196cee9cac4de0ad343e239 Mon Sep 17 00:00:00 2001 From: Haled Odat <8566042+HalidOdat@users.noreply.github.com> Date: Mon, 25 Sep 2023 19:35:36 +0200 Subject: [PATCH] Fix tagged template `this` in strict mode (#3307) In strict mode `this` should be undefined. --- boa_engine/src/bytecompiler/expression/mod.rs | 3 +-- boa_engine/src/bytecompiler/mod.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/boa_engine/src/bytecompiler/expression/mod.rs b/boa_engine/src/bytecompiler/expression/mod.rs index 5f9ee4c3d94..7dfc94b29c3 100644 --- a/boa_engine/src/bytecompiler/expression/mod.rs +++ b/boa_engine/src/bytecompiler/expression/mod.rs @@ -243,9 +243,8 @@ impl ByteCompiler<'_, '_> { self.emit(Opcode::GetPrivateField, &[Operand::U32(index)]); } expr => { + self.emit_opcode(Opcode::PushUndefined); self.compile_expr(expr, true); - self.emit_opcode(Opcode::This); - self.emit_opcode(Opcode::Swap); } } diff --git a/boa_engine/src/bytecompiler/mod.rs b/boa_engine/src/bytecompiler/mod.rs index 1d8c33695ca..f26546f938a 100644 --- a/boa_engine/src/bytecompiler/mod.rs +++ b/boa_engine/src/bytecompiler/mod.rs @@ -1441,9 +1441,8 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> { kind = CallKind::CallEval; } } - self.compile_expr(expr, true); self.emit_opcode(Opcode::PushUndefined); - self.emit_opcode(Opcode::Swap); + self.compile_expr(expr, true); } expr => { self.compile_expr(expr, true);