Bug 1186962. r=jorendorff a=abillings
authorJeff Walden <jwalden@mit.edu>
Wed, 12 Aug 2015 12:03:28 -0500
changeset 282151 6784f96467d8a8babd7a1ecb98c8d2e24113118c
parent 282150 c8b342e749014f9c0845bdba732d8fa9df6e145e
child 282152 6ca4bc2bbbff694e640eea548e01dd0321bac25f
push id5025
push userkwierso@gmail.com
push dateFri, 04 Sep 2015 21:00:27 +0000
treeherdermozilla-beta@cb4ecf5ce34a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, abillings
bugs1186962
milestone41.0
Bug 1186962. r=jorendorff a=abillings
js/src/frontend/ParseNode.cpp
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -800,33 +800,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);