зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1233120 - Check token after static in class declaration. r=jwalden
--HG-- extra : amend_source : 00131ffe51ac955eb2f2b3fcdbf6bf5cb41c1d83
This commit is contained in:
Родитель
19926801a4
Коммит
d0b665a995
|
@ -6780,6 +6780,13 @@ Parser<FullParseHandler>::classDefinition(YieldHandling yieldHandling,
|
|||
if (tt == TOK_NAME && tokenStream.currentName() == context->names().static_) {
|
||||
if (!tokenStream.peekToken(&tt, TokenStream::KeywordIsName))
|
||||
return null();
|
||||
if (tt == TOK_RC) {
|
||||
tokenStream.consumeKnownToken(tt, TokenStream::KeywordIsName);
|
||||
report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
|
||||
"property name", TokenKindToDesc(tt));
|
||||
return null();
|
||||
}
|
||||
|
||||
if (tt != TOK_LP) {
|
||||
if (!checkUnescapedName())
|
||||
return null();
|
||||
|
@ -9249,8 +9256,7 @@ Parser<ParseHandler>::propertyName(YieldHandling yieldHandling, Node propList,
|
|||
if (!tokenStream.getToken(<ok, TokenStream::KeywordIsName))
|
||||
return null();
|
||||
|
||||
// TOK_RC should be handled in caller.
|
||||
MOZ_ASSERT(ltok != TOK_RC);
|
||||
MOZ_ASSERT(ltok != TOK_RC, "caller should have handled TOK_RC");
|
||||
|
||||
bool isGenerator = false;
|
||||
if (ltok == TOK_MUL) {
|
||||
|
|
|
@ -479,6 +479,8 @@ function testClasses() {
|
|||
assertClassError("class NAME { static *y", SyntaxError);
|
||||
assertClassError("class NAME { static get", SyntaxError);
|
||||
assertClassError("class NAME { static get y", SyntaxError);
|
||||
assertClassError("class NAME { static }", SyntaxError);
|
||||
assertClassError("class NAME { static ;", SyntaxError);
|
||||
assertClassError("class NAME extends", SyntaxError);
|
||||
assertClassError("class NAME { constructor() { super", SyntaxError);
|
||||
assertClassError("class NAME { constructor() { super.", SyntaxError);
|
||||
|
|
Загрузка…
Ссылка в новой задаче