瀏覽代碼

LibJS/Bytecode: Handle object destructuring to member expression

19 new passes on test262. :^)
Andreas Kling 2 年之前
父節點
當前提交
6f0952c358
共有 1 個文件被更改,包括 2 次插入0 次删除
  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)
                 generator.emit<Bytecode::Op::CreateVariable>(identifier_ref, Bytecode::Op::EnvironmentMode::Lexical, false);
             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 {
             auto& identifier = alias.get<NonnullRefPtr<Identifier const>>()->string();
             auto identifier_ref = generator.intern_identifier(identifier);