mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:28: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
|
@ -382,6 +382,8 @@ Bytecode::CodeGenerationErrorOr<void> AssignmentExpression::generate_bytecode(By
|
|||
// To be continued later with PutByValue.
|
||||
} else if (expression.property().is_identifier()) {
|
||||
// Do nothing, this will be handled by PutById later.
|
||||
} else if (expression.property().is_private_identifier()) {
|
||||
// Do nothing, this will be handled by PutPrivateById later.
|
||||
} else {
|
||||
return Bytecode::CodeGenerationError {
|
||||
&expression,
|
||||
|
@ -415,6 +417,9 @@ Bytecode::CodeGenerationErrorOr<void> AssignmentExpression::generate_bytecode(By
|
|||
} else if (expression.property().is_identifier()) {
|
||||
auto identifier_table_ref = generator.intern_identifier(verify_cast<Identifier>(expression.property()).string());
|
||||
generator.emit<Bytecode::Op::PutById>(*base_object_register, identifier_table_ref);
|
||||
} else if (expression.property().is_private_identifier()) {
|
||||
auto identifier_table_ref = generator.intern_identifier(verify_cast<PrivateIdentifier>(expression.property()).string());
|
||||
generator.emit<Bytecode::Op::PutPrivateById>(*base_object_register, identifier_table_ref);
|
||||
} else {
|
||||
return Bytecode::CodeGenerationError {
|
||||
&expression,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue