1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:45:08 +00:00

LibJS/Bytecode: Simplify creating/leaving lexical environment

Since we no longer need to create or leave var environments directly
in bytecode, we can streamline the two instructions by making them
always operate on the lexical environment.
This commit is contained in:
Andreas Kling 2023-06-16 16:43:24 +02:00
parent 12ce0789da
commit dbfe1311ef
6 changed files with 25 additions and 45 deletions

View file

@ -2226,7 +2226,7 @@ Bytecode::CodeGenerationErrorOr<void> WithStatement::generate_bytecode(Bytecode:
generator.end_boundary(Bytecode::Generator::BlockBoundaryType::LeaveLexicalEnvironment);
if (!generator.is_current_block_terminated())
generator.emit<Bytecode::Op::LeaveEnvironment>(Bytecode::Op::EnvironmentMode::Lexical);
generator.emit<Bytecode::Op::LeaveLexicalEnvironment>();
return {};
}
@ -2282,7 +2282,7 @@ static Bytecode::CodeGenerationErrorOr<ForInOfHeadEvaluationResult> for_in_of_he
generator.emit<Bytecode::Op::CreateVariable>(identifier, Bytecode::Op::EnvironmentMode::Lexical, false);
}));
// d. Set the running execution context's LexicalEnvironment to newEnv.
// NOTE: Done by CreateEnvironment.
// NOTE: Done by CreateLexicalEnvironment.
}
} else {
// Runtime Semantics: ForInOfLoopEvaluation, for any of: