Bug 1186962. r=jorendorff a=abillings
authorJeff Walden <jwalden@mit.edu>
Wed, 12 Aug 2015 12:03:28 -0500
changeset 277520 472861dd7df6ad2000fe6d8e8271cfd7f82a876d
parent 277519 f4e37234ca806d4ea2d722bd30399ca2b1acde37
child 277521 e96c99debcb639585f69daaefc5882040b4c722f
push id8381
push userkwierso@gmail.com
push dateFri, 04 Sep 2015 20:23:22 +0000
treeherdermozilla-aurora@7ba5523ffb28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, abillings
bugs1186962
milestone42.0a2
Bug 1186962. r=jorendorff a=abillings
js/src/frontend/ParseNode.cpp
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -813,33 +813,32 @@ Parser<FullParseHandler>::cloneLeftHandS
 
     if (opn->isArity(PN_LIST)) {
         MOZ_ASSERT(opn->isKind(PNK_ARRAY) || opn->isKind(PNK_OBJECT));
         pn->makeEmpty();
         for (ParseNode* opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) {
             ParseNode* pn2;
             if (opn->isKind(PNK_OBJECT)) {
                 if (opn2->isKind(PNK_MUTATEPROTO)) {
-                    ParseNode* target = cloneLeftHandSide(opn2->pn_kid);
+                    ParseNode* target = opn2->pn_kid->isKind(PNK_ASSIGN)
+                                        ? cloneDestructuringDefault(opn2->pn_kid)
+                                        : cloneLeftHandSide(opn2->pn_kid);
                     if (!target)
                         return nullptr;
                     pn2 = handler.new_<UnaryNode>(PNK_MUTATEPROTO, JSOP_NOP, opn2->pn_pos, target);
                 } else {
                     MOZ_ASSERT(opn2->isArity(PN_BINARY));
                     MOZ_ASSERT(opn2->isKind(PNK_COLON) || opn2->isKind(PNK_SHORTHAND));
 
                     ParseNode* tag = cloneParseTree(opn2->pn_left);
                     if (!tag)
                         return nullptr;
-                    ParseNode* target;
-                    if (opn2->pn_right->isKind(PNK_ASSIGN)) {
-                        target = cloneDestructuringDefault(opn2->pn_right);
-                    } else {
-                        target = cloneLeftHandSide(opn2->pn_right);
-                    }
+                    ParseNode* target = opn2->pn_right->isKind(PNK_ASSIGN)
+                                        ? cloneDestructuringDefault(opn2->pn_right)
+                                        : cloneLeftHandSide(opn2->pn_right);
                     if (!target)
                         return nullptr;
 
                     pn2 = handler.new_<BinaryNode>(opn2->getKind(), JSOP_INITPROP, opn2->pn_pos, tag, target);
                 }
             } else if (opn2->isArity(PN_NULLARY)) {
                 MOZ_ASSERT(opn2->isKind(PNK_ELISION));
                 pn2 = cloneParseTree(opn2);