diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 746a24af9b3..5919c40063c 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -6780,6 +6780,13 @@ Parser::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::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) { diff --git a/js/src/tests/js1_8_5/reflect-parse/classes.js b/js/src/tests/js1_8_5/reflect-parse/classes.js index d94ce9efb1b..d479f56fc86 100644 --- a/js/src/tests/js1_8_5/reflect-parse/classes.js +++ b/js/src/tests/js1_8_5/reflect-parse/classes.js @@ -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);