mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibJS/Bytecode: Support in
binary operator for private fields
11 new passes on test262. :^)
This commit is contained in:
parent
e4b6c402cb
commit
e87d84f883
Notes:
sideshowbarker
2024-07-17 04:41:05 +09:00
Author: https://github.com/awesomekling
Commit: e87d84f883
Pull-request: https://github.com/SerenityOS/serenity/pull/19814
Reviewed-by: https://github.com/Hendiadyoin1
4 changed files with 44 additions and 0 deletions
|
@ -66,6 +66,13 @@ Bytecode::CodeGenerationErrorOr<void> ExpressionStatement::generate_bytecode(Byt
|
|||
|
||||
Bytecode::CodeGenerationErrorOr<void> BinaryExpression::generate_bytecode(Bytecode::Generator& generator) const
|
||||
{
|
||||
if (m_op == BinaryOp::In && is<PrivateIdentifier>(*m_lhs)) {
|
||||
auto const& private_identifier = static_cast<PrivateIdentifier const&>(*m_lhs).string();
|
||||
TRY(m_rhs->generate_bytecode(generator));
|
||||
generator.emit<Bytecode::Op::HasPrivateId>(generator.intern_identifier(private_identifier));
|
||||
return {};
|
||||
}
|
||||
|
||||
TRY(m_lhs->generate_bytecode(generator));
|
||||
auto lhs_reg = generator.allocate_register();
|
||||
generator.emit<Bytecode::Op::Store>(lhs_reg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue