Bug 1066238 - Part 2: Emitter support for static class methods. (r=jorendorff)

This commit is contained in:
Eric Faust 2015-02-26 15:05:24 -08:00
parent e79580725f
commit 880e2eb983

View File

@ -6579,6 +6579,15 @@ EmitPropertyList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn,
continue;
}
bool extraPop = false;
if (type == ClassBody && propdef->as<ClassMethod>().isStatic()) {
extraPop = true;
if (Emit1(cx, bce, JSOP_DUP2) < 0)
return false;
if (Emit1(cx, bce, JSOP_POP) < 0)
return false;
}
/* Emit an index for t[2] for later consumption by JSOP_INITELEM. */
ParseNode *key = propdef->pn_left;
bool isIndex = false;
@ -6652,6 +6661,11 @@ EmitPropertyList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn,
if (!EmitIndex32(cx, op, index, bce))
return false;
}
if (extraPop) {
if (Emit1(cx, bce, JSOP_POP) < 0)
return false;
}
}
return true;
}