Browse Source

LibJS/Bytecode: Handle object destructuring to member expression

19 new passes on test262. :^)
Andreas Kling 2 years ago
parent
commit
6f0952c358
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp

+ 2 - 0
Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp

@@ -1081,6 +1081,8 @@ static Bytecode::CodeGenerationErrorOr<void> generate_object_binding_pattern_byt
             if (create_variables)
             if (create_variables)
                 generator.emit<Bytecode::Op::CreateVariable>(identifier_ref, Bytecode::Op::EnvironmentMode::Lexical, false);
                 generator.emit<Bytecode::Op::CreateVariable>(identifier_ref, Bytecode::Op::EnvironmentMode::Lexical, false);
             generator.emit<Bytecode::Op::SetVariable>(identifier_ref, initialization_mode);
             generator.emit<Bytecode::Op::SetVariable>(identifier_ref, initialization_mode);
+        } else if (alias.has<NonnullRefPtr<MemberExpression const>>()) {
+            TRY(generator.emit_store_to_reference(alias.get<NonnullRefPtr<MemberExpression const>>()));
         } else {
         } else {
             auto& identifier = alias.get<NonnullRefPtr<Identifier const>>()->string();
             auto& identifier = alias.get<NonnullRefPtr<Identifier const>>()->string();
             auto identifier_ref = generator.intern_identifier(identifier);
             auto identifier_ref = generator.intern_identifier(identifier);