From bd2c3ace686b60bf70cfae68f36b1c25fc685081 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 2 Jul 2023 10:28:36 +0200 Subject: [PATCH] LibJS/Bytecode: Make sure empty `with` statement results in `undefined` 2 new passes on test262. :^) --- Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 33875a71a1..3a555b10a6 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -2372,6 +2372,9 @@ Bytecode::CodeGenerationErrorOr WithStatement::generate_bytecode(Bytecode: // EnterObjectEnvironment sets the running execution context's lexical_environment to a new Object Environment. generator.start_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment); + + generator.emit(js_undefined()); + TRY(m_body->generate_bytecode(generator)); generator.end_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment);