Bug 1126754 - Correctly note new pn_tail; factor out ParseNode::prepend (r=jandem)

This commit is contained in:
Luke Wagner 2015-01-28 10:21:43 -06:00
parent 8941696daf
commit 21fb40d09f
4 changed files with 20 additions and 9 deletions

View File

@ -382,10 +382,7 @@ class FullParseHandler
if (!initialYield)
return false;
initialYield->pn_next = stmtList->pn_head;
stmtList->pn_head = initialYield;
stmtList->pn_count++;
stmtList->prepend(initialYield);
return true;
}

View File

@ -848,6 +848,15 @@ class ParseNode
pn_count++;
}
void prepend(ParseNode *pn) {
MOZ_ASSERT(pn_arity == PN_LIST);
pn->pn_next = pn_head;
pn_head = pn;
if (pn_tail == &pn_head)
pn_tail = &pn->pn_next;
pn_count++;
}
void checkListConsistency()
#ifndef DEBUG
{}

View File

@ -2253,11 +2253,7 @@ Parser<FullParseHandler>::finishFunctionDefinition(ParseNode *pn, FunctionBox *f
if (!item)
return false;
item->pn_next = body->pn_head;
body->pn_head = item;
if (body->pn_tail == &body->pn_head)
body->pn_tail = &item->pn_next;
++body->pn_count;
body->prepend(item);
body->pn_xflags |= PNX_DESTRUCT;
}

View File

@ -0,0 +1,9 @@
// |jit-test| error:SyntaxError
(function() {
with ({}) {}
function f() {
({ *h(){} })
}
function f
})()