Allow static as method name in class (fixes #192).

Add uncommitted tests for #191.
This commit is contained in:
Ingvar Stepanyan
2015-01-09 15:31:01 +02:00
parent 3d9048a692
commit bc2e01aa03
3 changed files with 176 additions and 6 deletions

View File

@@ -2510,14 +2510,17 @@
expect(_braceL);
while (!eat(_braceR)) {
var method = startNode();
if (tokType === _name && tokVal === "static") {
next();
var isGenerator = eat(_star);
parsePropertyName(method);
if (tokType !== _parenL && !method.computed && method.key.type === "Identifier" &&
method.key.name === "static") {
if (isGenerator) unexpected();
method['static'] = true;
isGenerator = eat(_star);
parsePropertyName(method);
} else {
method['static'] = false;
}
var isGenerator = eat(_star);
parsePropertyName(method);
if (tokType !== _parenL && !method.computed && method.key.type === "Identifier" &&
(method.key.name === "get" || method.key.name === "set")) {
if (isGenerator) unexpected();