Bug 1203733 - Fix emitting super.prop1.prop2. (r=jorendorff)

This commit is contained in:
Eric Faust 2015-09-18 09:23:21 -07:00
parent d9f4dfbbb5
commit e5087d26a8
2 changed files with 21 additions and 4 deletions

View File

@ -2551,17 +2551,16 @@ bool
BytecodeEmitter::emitPropLHS(ParseNode* pn)
{
MOZ_ASSERT(pn->isKind(PNK_DOT));
ParseNode* pn2 = pn->maybeExpr();
MOZ_ASSERT(!pn->as<PropertyAccess>().isSuper());
// Don't want super sneaking in here.
MOZ_ASSERT(!pn2->isKind(PNK_POSHOLDER));
ParseNode* pn2 = pn->maybeExpr();
/*
* If the object operand is also a dotted property reference, reverse the
* list linked via pn_expr temporarily so we can iterate over it from the
* bottom up (reversing again as we go), to avoid excessive recursion.
*/
if (pn2->isKind(PNK_DOT)) {
if (pn2->isKind(PNK_DOT) && !pn2->as<PropertyAccess>().isSuper()) {
ParseNode* pndot = pn2;
ParseNode* pnup = nullptr;
ParseNode* pndown;

View File

@ -0,0 +1,18 @@
var test = `
var o = {
access() {
super.foo.bar;
}
};
// Delazify
assertThrowsInstanceOf(o.access, TypeError);
`;
if (classesEnabled())
eval(test);
if (typeof reportCompare === 'function')
reportCompare(0,0,"OK");