diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index e5e3704bbe..9b0c95b749 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -375,14 +375,18 @@ void AssignmentExpression::generate_bytecode(Bytecode::Generator& generator) con generator.emit<Bytecode::Op::Store>(object_reg); if (expression.is_computed()) { - TODO(); + expression.property().generate_bytecode(generator); + auto property_reg = generator.allocate_register(); + generator.emit<Bytecode::Op::Store>(property_reg); + m_rhs->generate_bytecode(generator); + generator.emit<Bytecode::Op::PutByValue>(object_reg, property_reg); } else { VERIFY(is<Identifier>(expression.property())); m_rhs->generate_bytecode(generator); auto identifier_table_ref = generator.intern_string(static_cast<Identifier const&>(expression.property()).string()); generator.emit<Bytecode::Op::PutById>(object_reg, identifier_table_ref); - return; } + return; } TODO(); @@ -585,7 +589,11 @@ void MemberExpression::generate_bytecode(Bytecode::Generator& generator) const object().generate_bytecode(generator); if (is_computed()) { - TODO(); + auto object_reg = generator.allocate_register(); + generator.emit<Bytecode::Op::Store>(object_reg); + + property().generate_bytecode(generator); + generator.emit<Bytecode::Op::GetByValue>(object_reg); } else { VERIFY(is<Identifier>(property())); auto identifier_table_ref = generator.intern_string(static_cast<Identifier const&>(property()).string()); |