зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1529772 - Part 3: Implement ASI for fields that have initializers. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D26037 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d2cf2ed9f7
Коммит
241459d345
|
@ -2027,9 +2027,10 @@ JSFunction* ParserBase::newFunction(HandleAtom atom, FunctionSyntaxKind kind,
|
|||
}
|
||||
|
||||
template <class ParseHandler, typename Unit>
|
||||
bool GeneralParser<ParseHandler, Unit>::matchOrInsertSemicolon() {
|
||||
bool GeneralParser<ParseHandler, Unit>::matchOrInsertSemicolon(
|
||||
Modifier modifier /* = TokenStream::SlashIsRegExp */) {
|
||||
TokenKind tt = TokenKind::Eof;
|
||||
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::SlashIsRegExp)) {
|
||||
if (!tokenStream.peekTokenSameLine(&tt, modifier)) {
|
||||
return false;
|
||||
}
|
||||
if (tt != TokenKind::Eof && tt != TokenKind::Eol && tt != TokenKind::Semi &&
|
||||
|
@ -2057,13 +2058,12 @@ bool GeneralParser<ParseHandler, Unit>::matchOrInsertSemicolon() {
|
|||
}
|
||||
|
||||
/* Advance the scanner for proper error location reporting. */
|
||||
tokenStream.consumeKnownToken(tt, TokenStream::SlashIsRegExp);
|
||||
tokenStream.consumeKnownToken(tt, modifier);
|
||||
error(JSMSG_UNEXPECTED_TOKEN_NO_EXPECT, TokenKindToDesc(tt));
|
||||
return false;
|
||||
}
|
||||
bool matched;
|
||||
return tokenStream.matchToken(&matched, TokenKind::Semi,
|
||||
TokenStream::SlashIsRegExp);
|
||||
return tokenStream.matchToken(&matched, TokenKind::Semi, modifier);
|
||||
}
|
||||
|
||||
bool ParserBase::leaveInnerFunction(ParseContext* outerpc) {
|
||||
|
@ -6811,13 +6811,7 @@ bool GeneralParser<ParseHandler, Unit>::classMember(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!tokenStream.getToken(&tt, TokenStream::SlashIsInvalid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(khyperia): Implement ASI
|
||||
if (tt != TokenKind::Semi) {
|
||||
error(JSMSG_MISSING_SEMI_FIELD);
|
||||
if (!matchOrInsertSemicolon(TokenStream::SlashIsInvalid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1426,7 +1426,17 @@ class MOZ_STACK_CLASS GeneralParser : public PerHandlerParser<ParseHandler> {
|
|||
GeneratorKind generatorKind, FunctionAsyncKind asyncKind, bool tryAnnexB,
|
||||
Directives inheritedDirectives, Directives* newDirectives);
|
||||
|
||||
bool matchOrInsertSemicolon();
|
||||
// Implements Automatic Semicolon Insertion.
|
||||
//
|
||||
// Use this to match `;` in contexts where ASI is allowed. Call this after
|
||||
// ruling out all other possibilities except `;`, by peeking ahead if
|
||||
// necessary.
|
||||
//
|
||||
// Unlike most optional Modifiers, this method's `modifier` argument defaults
|
||||
// to SlashIsRegExp, since that's by far the most common case: usually an
|
||||
// optional semicolon is at the end of a statement or declaration, and the
|
||||
// next token could be a RegExp literal beginning a new ExpressionStatement.
|
||||
bool matchOrInsertSemicolon(Modifier modifier = TokenStream::SlashIsRegExp);
|
||||
|
||||
bool noteDeclaredName(HandlePropertyName name, DeclarationKind kind,
|
||||
TokenPos pos);
|
||||
|
|
|
@ -353,7 +353,6 @@ MSG_DEF(JSMSG_COMPUTED_NAME_IN_PATTERN,0, JSEXN_SYNTAXERR, "computed property na
|
|||
MSG_DEF(JSMSG_DEFAULT_IN_PATTERN, 0, JSEXN_SYNTAXERR, "destructuring defaults aren't supported in this destructuring declaration")
|
||||
MSG_DEF(JSMSG_BAD_NEWTARGET, 0, JSEXN_SYNTAXERR, "new.target only allowed within functions")
|
||||
MSG_DEF(JSMSG_ESCAPED_KEYWORD, 0, JSEXN_SYNTAXERR, "keywords must be written literally, without embedded escapes")
|
||||
MSG_DEF(JSMSG_MISSING_SEMI_FIELD, 0, JSEXN_SYNTAXERR, "missing ; after field definition")
|
||||
MSG_DEF(JSMSG_FIELDS_NOT_SUPPORTED, 0, JSEXN_SYNTAXERR, "fields are not currently supported")
|
||||
|
||||
// UTF-8 source text encoding errors
|
||||
|
|
|
@ -565,85 +565,46 @@ skip script test262/language/expressions/class/elements/after-same-line-static-a
|
|||
skip script test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/after-same-line-static-gen-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/after-same-line-static-method-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/fields-asi-1.js
|
||||
skip script test262/language/expressions/class/elements/fields-asi-2.js
|
||||
skip script test262/language/expressions/class/elements/fields-asi-5.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-computed-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-computed-symbol-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier-initializer.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier.js
|
||||
skip script test262/language/expressions/class/elements/multiple-definitions-string-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-computed-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-computed-symbol-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier.js
|
||||
skip script test262/language/expressions/class/elements/multiple-stacked-definitions-string-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-computed-names.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-computed-symbol-names.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier.js
|
||||
skip script test262/language/expressions/class/elements/new-no-sc-line-method-string-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/new-sc-line-gen-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/new-sc-line-method-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-computed-names.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-computed-symbol-names.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-rs-field-identifier-initializer.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-rs-field-identifier.js
|
||||
skip script test262/language/expressions/class/elements/regular-definitions-string-literal-names.js
|
||||
skip script test262/language/expressions/class/elements/same-line-async-gen-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/same-line-async-method-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/same-line-gen-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/same-line-method-literal-names-asi.js
|
||||
skip script test262/language/expressions/class/elements/syntax/valid/grammar-fields-multi-line.js
|
||||
skip script test262/language/expressions/class/elements/wrapped-in-sc-literal-names-asi.js
|
||||
skip script test262/language/statements/class/classelementname-abrupt-completion.js
|
||||
skip script test262/language/statements/class/elements/after-same-line-gen-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/after-same-line-method-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/after-same-line-static-async-method-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/after-same-line-static-gen-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/after-same-line-static-method-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/fields-asi-1.js
|
||||
skip script test262/language/statements/class/elements/fields-asi-2.js
|
||||
skip script test262/language/statements/class/elements/fields-asi-5.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-computed-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-computed-symbol-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-literal-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-rs-field-identifier-initializer.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-rs-field-identifier.js
|
||||
skip script test262/language/statements/class/elements/multiple-definitions-string-literal-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-computed-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-computed-symbol-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-literal-names.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier.js
|
||||
skip script test262/language/statements/class/elements/multiple-stacked-definitions-string-literal-names.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-computed-names.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-computed-symbol-names.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-literal-names.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier.js
|
||||
skip script test262/language/statements/class/elements/new-no-sc-line-method-string-literal-names.js
|
||||
skip script test262/language/statements/class/elements/new-sc-line-gen-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/new-sc-line-method-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-computed-names.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-computed-symbol-names.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-literal-names.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-rs-field-identifier-initializer.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-rs-field-identifier.js
|
||||
skip script test262/language/statements/class/elements/regular-definitions-string-literal-names.js
|
||||
skip script test262/language/statements/class/elements/same-line-async-gen-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/same-line-async-method-literal-names-asi.js
|
||||
skip script test262/language/statements/class/elements/same-line-gen-literal-names-asi.js
|
||||
|
|
Загрузка…
Ссылка в новой задаче