Browse Source

Fix tagged template `this` in strict mode (#3307)

In strict mode `this` should be undefined.
pull/3309/head
Haled Odat 1 year ago committed by GitHub
parent
commit
fd2e5589ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      boa_engine/src/bytecompiler/expression/mod.rs
  2. 3
      boa_engine/src/bytecompiler/mod.rs

3
boa_engine/src/bytecompiler/expression/mod.rs

@ -243,9 +243,8 @@ impl ByteCompiler<'_, '_> {
self.emit(Opcode::GetPrivateField, &[Operand::U32(index)]); self.emit(Opcode::GetPrivateField, &[Operand::U32(index)]);
} }
expr => { expr => {
self.emit_opcode(Opcode::PushUndefined);
self.compile_expr(expr, true); self.compile_expr(expr, true);
self.emit_opcode(Opcode::This);
self.emit_opcode(Opcode::Swap);
} }
} }

3
boa_engine/src/bytecompiler/mod.rs

@ -1441,9 +1441,8 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> {
kind = CallKind::CallEval; kind = CallKind::CallEval;
} }
} }
self.compile_expr(expr, true);
self.emit_opcode(Opcode::PushUndefined); self.emit_opcode(Opcode::PushUndefined);
self.emit_opcode(Opcode::Swap); self.compile_expr(expr, true);
} }
expr => { expr => {
self.compile_expr(expr, true); self.compile_expr(expr, true);

Loading…
Cancel
Save