Bug 1023686 - Fix JSOP of definition nodes of non-hoisted declarations. (r=luke)

This commit is contained in:
Shu-yu Guo 2014-06-12 00:27:46 -07:00
Родитель 17e3efade0
Коммит 723812d679
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -3061,7 +3061,7 @@ EmitDestructuringLHS(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn,
} else if (emitOption == PushInitialValues) {
// The lhs is a simple name so the to-be-destructured value is
// its initial value and there is nothing to do.
JS_ASSERT(pn->getOp() == JSOP_GETLOCAL);
JS_ASSERT(pn->getOp() == JSOP_SETLOCAL);
JS_ASSERT(pn->pn_dflags & PND_BOUND);
} else {
switch (pn->getKind()) {

Просмотреть файл

@ -150,7 +150,7 @@ ParseContext<FullParseHandler>::define(TokenStream &ts,
switch (kind) {
case Definition::ARG:
JS_ASSERT(sc->isFunctionBox());
dn->setOp(JSOP_GETARG);
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETARG : JSOP_GETARG);
dn->pn_dflags |= PND_BOUND;
if (!dn->pn_cookie.set(ts, staticLevel, args_.length()))
return false;
@ -169,7 +169,7 @@ ParseContext<FullParseHandler>::define(TokenStream &ts,
case Definition::CONST:
case Definition::VAR:
if (sc->isFunctionBox()) {
dn->setOp(JSOP_GETLOCAL);
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETLOCAL : JSOP_GETLOCAL);
dn->pn_dflags |= PND_BOUND;
if (!dn->pn_cookie.set(ts, staticLevel, vars_.length()))
return false;
@ -185,7 +185,7 @@ ParseContext<FullParseHandler>::define(TokenStream &ts,
break;
case Definition::LET:
dn->setOp(JSOP_GETLOCAL);
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETLOCAL : JSOP_GETLOCAL);
dn->pn_dflags |= (PND_LET | PND_BOUND);
JS_ASSERT(dn->pn_cookie.level() == staticLevel); /* see bindLet */
if (!decls_.addShadow(name, dn))