Bug 492714 - "Assertion failure: cg->staticLevel >= level, at ../jsemit.cpp" with genexp. r=brendan
authorJason Orendorff <jorendorff@mozilla.com>
Wed, 13 May 2009 19:02:33 -0500
changeset 28354 7797c629c576f047a05ba97c4bcea3ea2036a3dd
parent 28353 dead45971ca20199d961ba3c0bb626417deced4d
child 28355 a75d552b0c642d9753f50a603ada7b2578101ec2
push idunknown
push userunknown
push dateunknown
reviewersbrendan
bugs492714
milestone1.9.2a1pre
Bug 492714 - "Assertion failure: cg->staticLevel >= level, at ../jsemit.cpp" with genexp. r=brendan
js/src/jsparse.cpp
js/src/jsparse.h
--- a/js/src/jsparse.cpp
+++ b/js/src/jsparse.cpp
@@ -6086,17 +6086,20 @@ CompExprTransplanter::transplant(JSParse
       case PN_TERNARY:
         transplant(pn->pn_kid1);
         transplant(pn->pn_kid2);
         transplant(pn->pn_kid3);
         break;
 
       case PN_BINARY:
         transplant(pn->pn_left);
-        transplant(pn->pn_right);
+
+        /* Binary TOK_COLON nodes can have left == right. See bug 492714. */
+        if (pn->pn_right != pn->pn_left)
+            transplant(pn->pn_right);
         break;
 
       case PN_UNARY:
         transplant(pn->pn_kid);
         break;
 
       case PN_FUNC:
       {
--- a/js/src/jsparse.h
+++ b/js/src/jsparse.h
@@ -178,18 +178,20 @@ JS_BEGIN_EXTERN_C
  * TOK_LB       binary      pn_left: MEMBER expr to left of [
  *                          pn_right: expr between [ and ]
  * TOK_LP       list        pn_head: list of call, arg1, arg2, ... argN
  *                          pn_count: 1 + N (where N is number of args)
  *                          call is a MEMBER expr naming a callable object
  * TOK_RB       list        pn_head: list of pn_count array element exprs
  *                          [,,] holes are represented by TOK_COMMA nodes
  *                          pn_xflags: PN_ENDCOMMA if extra comma at end
- * TOK_RC       list        pn_head: list of pn_count TOK_COLON nodes where
- *                          each has pn_left: property id, pn_right: value
+ * TOK_RC       list        pn_head: list of pn_count binary TOK_COLON nodes
+ * TOK_COLON    binary      key-value pair in object initializer or
+ *                          destructuring lhs
+ *                          pn_left: property id, pn_right: value
  *                          var {x} = object destructuring shorthand shares
  *                          PN_NAME node for x on left and right of TOK_COLON
  *                          node in TOK_RC's list, has PNX_DESTRUCT flag
  * TOK_DEFSHARP unary       pn_num: jsint value of n in #n=
  *                          pn_kid: primary function, paren, name, object or
  *                                  array literal expressions
  * TOK_USESHARP nullary     pn_num: jsint value of n in #n#
  * TOK_RP       unary       pn_kid: parenthesized expression