1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

LibJS: Implement bytecode generation for WithStatement

This commit is contained in:
Ali Mohammad Pur 2022-03-13 16:01:18 +03:30 committed by Andreas Kling
parent 57386ca839
commit 2000251333
5 changed files with 38 additions and 0 deletions

View file

@ -1618,4 +1618,13 @@ Bytecode::CodeGenerationErrorOr<void> AwaitExpression::generate_bytecode(Bytecod
return {};
}
Bytecode::CodeGenerationErrorOr<void> WithStatement::generate_bytecode(Bytecode::Generator& generator) const
{
TRY(m_object->generate_bytecode(generator));
generator.emit<Bytecode::Op::EnterObjectEnvironment>();
TRY(m_body->generate_bytecode(generator));
generator.emit<Bytecode::Op::LeaveEnvironment>(Bytecode::Op::EnvironmentMode::Lexical);
return {};
}
}