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:
parent
12ce0789da
commit
dbfe1311ef
6 changed files with 25 additions and 45 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue