Bug 1185959 - Properly handle static constructor method in classes. (r=Waldo)

This commit is contained in:
Eric Faust 2015-08-19 11:19:46 -07:00
Родитель 9602783f5f
Коммит 240506f142
2 изменённых файлов: 16 добавлений и 1 удалений

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

@ -7007,8 +7007,11 @@ BytecodeEmitter::emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp,
isIndex = true;
} else if (key->isKind(PNK_OBJECT_PROPERTY_NAME) || key->isKind(PNK_STRING)) {
// EmitClass took care of constructor already.
if (type == ClassBody && key->pn_atom == cx->names().constructor)
if (type == ClassBody && key->pn_atom == cx->names().constructor &&
!propdef->as<ClassMethod>().isStatic())
{
continue;
}
// The parser already checked for atoms representing indexes and
// used PNK_NUMBER instead, but also watch for ids which TI treats

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

@ -0,0 +1,12 @@
var test = `
class test {
constructor() { }
static constructor() { }
}
`;
if (classesEnabled())
eval(test);
if (typeof reportCompare === "function")
reportCompare(0,0,"OK");