Procházet zdrojové kódy

LibJS/Bytecode: Make sure empty `with` statement results in `undefined`

2 new passes on test262. :^)
Andreas Kling před 2 roky
rodič
revize
bd2c3ace68
1 změnil soubory, kde provedl 3 přidání a 0 odebrání
  1. 3 0
      Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp

+ 3 - 0
Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp

@@ -2372,6 +2372,9 @@ Bytecode::CodeGenerationErrorOr<void> WithStatement::generate_bytecode(Bytecode:
 
 
     // EnterObjectEnvironment sets the running execution context's lexical_environment to a new Object Environment.
     // EnterObjectEnvironment sets the running execution context's lexical_environment to a new Object Environment.
     generator.start_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment);
     generator.start_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment);
+
+    generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
+
     TRY(m_body->generate_bytecode(generator));
     TRY(m_body->generate_bytecode(generator));
     generator.end_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment);
     generator.end_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment);