Bug 923860 - Watch for ids considered to be integers by TI when emitting destructuring prop/elem accesses, r=jandem.

This commit is contained in:
Brian Hackett 2013-10-10 11:15:27 -06:00
parent 7b1cc9bd66
commit 693135a679

View File

@ -3009,10 +3009,19 @@ EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode
if (!EmitNumberOp(cx, pn3->pn_dval, bce))
return false;
} else {
// The parser already checked for atoms representing indexes and
// used PNK_NUMBER instead, but also watch for ids which TI treats
// as indexes for simpliciation of downstream analysis.
JS_ASSERT(pn3->isKind(PNK_STRING) || pn3->isKind(PNK_NAME));
if (!EmitAtomOp(cx, pn3, JSOP_GETPROP, bce))
return false;
doElemOp = false;
jsid id = NameToId(pn3->pn_atom->asPropertyName());
if (id != types::IdToTypeId(id)) {
if (!EmitTree(cx, bce, pn3))
return false;
} else {
if (!EmitAtomOp(cx, pn3, JSOP_GETPROP, bce))
return false;
doElemOp = false;
}
}
pn3 = pn2->pn_right;
}