mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibJS/Bytecode: Support private class fields
This is accomplished with two new instructions: - GetPrivateById - PutPrivateById Looks like 1616 new passes on test262. :^)
This commit is contained in:
parent
467ea86179
commit
e5c7d8407b
5 changed files with 93 additions and 0 deletions
|
@ -198,6 +198,9 @@ CodeGenerationErrorOr<void> Generator::emit_load_from_reference(JS::ASTNode cons
|
|||
} else if (expression.property().is_identifier()) {
|
||||
auto identifier_table_ref = intern_identifier(verify_cast<Identifier>(expression.property()).string());
|
||||
emit<Bytecode::Op::GetById>(identifier_table_ref);
|
||||
} else if (expression.property().is_private_identifier()) {
|
||||
auto identifier_table_ref = intern_identifier(verify_cast<PrivateIdentifier>(expression.property()).string());
|
||||
emit<Bytecode::Op::GetPrivateById>(identifier_table_ref);
|
||||
} else {
|
||||
return CodeGenerationError {
|
||||
&expression,
|
||||
|
@ -238,6 +241,10 @@ CodeGenerationErrorOr<void> Generator::emit_store_to_reference(JS::ASTNode const
|
|||
emit<Bytecode::Op::Load>(value_reg);
|
||||
auto identifier_table_ref = intern_identifier(verify_cast<Identifier>(expression.property()).string());
|
||||
emit<Bytecode::Op::PutById>(object_reg, identifier_table_ref);
|
||||
} else if (expression.property().is_private_identifier()) {
|
||||
emit<Bytecode::Op::Load>(value_reg);
|
||||
auto identifier_table_ref = intern_identifier(verify_cast<PrivateIdentifier>(expression.property()).string());
|
||||
emit<Bytecode::Op::PutPrivateById>(object_reg, identifier_table_ref);
|
||||
} else {
|
||||
return CodeGenerationError {
|
||||
&expression,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue