mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-25 19:02:07 -05:00
LibJS/Bytecode: Actually get value from super base for computed property
This commit is contained in:
parent
1116ba191a
commit
357174d8fd
2 changed files with 8 additions and 2 deletions
|
@ -1311,7 +1311,10 @@ static Bytecode::CodeGenerationErrorOr<void> get_base_and_value_from_member_expr
|
|||
if (computed_property_value_register.has_value()) {
|
||||
// 5. Let propertyKey be ? ToPropertyKey(propertyNameValue).
|
||||
// FIXME: This does ToPropertyKey out of order, which is observable by Symbol.toPrimitive!
|
||||
generator.emit<Bytecode::Op::GetByValue>(*computed_property_value_register);
|
||||
auto super_base_register = generator.allocate_register();
|
||||
generator.emit<Bytecode::Op::Store>(super_base_register);
|
||||
generator.emit<Bytecode::Op::Load>(*computed_property_value_register);
|
||||
generator.emit<Bytecode::Op::GetByValue>(super_base_register);
|
||||
} else {
|
||||
// 3. Let propertyKey be StringValue of IdentifierName.
|
||||
auto identifier_table_ref = generator.intern_identifier(verify_cast<Identifier>(member_expression.property()).string());
|
||||
|
|
|
@ -177,7 +177,10 @@ CodeGenerationErrorOr<void> Generator::emit_load_from_reference(JS::ASTNode cons
|
|||
if (computed_property_value_register.has_value()) {
|
||||
// 5. Let propertyKey be ? ToPropertyKey(propertyNameValue).
|
||||
// FIXME: This does ToPropertyKey out of order, which is observable by Symbol.toPrimitive!
|
||||
emit<Bytecode::Op::GetByValue>(*computed_property_value_register);
|
||||
auto super_base_register = allocate_register();
|
||||
emit<Bytecode::Op::Store>(super_base_register);
|
||||
emit<Bytecode::Op::Load>(*computed_property_value_register);
|
||||
emit<Bytecode::Op::GetByValue>(super_base_register);
|
||||
} else {
|
||||
// 3. Let propertyKey be StringValue of IdentifierName.
|
||||
auto identifier_table_ref = intern_identifier(verify_cast<Identifier>(expression.property()).string());
|
||||
|
|
Loading…
Add table
Reference in a new issue