Bug 1199172 - Only treat non-static constructor methods as the actual class constructor. (r=shu)

This commit is contained in:
Eric Faust 2015-08-27 15:27:07 -07:00
parent 4bb887fa2a
commit 6d419d0546
2 changed files with 17 additions and 1 deletions

View File

@ -7461,7 +7461,8 @@ BytecodeEmitter::emitClass(ParseNode* pn)
for (ParseNode* mn = classMethods->pn_head; mn; mn = mn->pn_next) {
ClassMethod& method = mn->as<ClassMethod>();
ParseNode& methodName = method.name();
if (methodName.isKind(PNK_OBJECT_PROPERTY_NAME) &&
if (!method.isStatic() &&
methodName.isKind(PNK_OBJECT_PROPERTY_NAME) &&
methodName.pn_atom == cx->names().constructor)
{
constructor = &method.method();

View File

@ -3,6 +3,21 @@ class test {
constructor() { }
static constructor() { }
}
class testWithExtends {
constructor() { };
static constructor() { };
}
class testOrder {
static constructor() { };
constructor() { };
}
class testOrderWithExtends extends null {
static constructor() { };
constructor() { };
}
`;
if (classesEnabled())