Skip to content

Commit

Permalink
Bug 1629793: Allow standalone 'static' as a class instance field name…
Browse files Browse the repository at this point in the history
…. r=arai

Class instance fields can be named "static", so we need to handle the
following three cases:

- `TokenKind::Assign` (for `class { static = <expr>; }`),
- `TokenKind::Semi` (for: `class { static; }`),
- and `TokenKind::RightCurly` (for `class { static }`).

Depends on D70813

Differential Revision: https://phabricator.services.mozilla.com/D70814

--HG--
extra : moz-landing-system : lando
  • Loading branch information
anba committed Apr 14, 2020
1 parent fde2631 commit eec403b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
8 changes: 2 additions & 6 deletions js/src/frontend/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6853,13 +6853,9 @@ bool GeneralParser<ParseHandler, Unit>::classMember(
if (!tokenStream.peekToken(&tt)) {
return false;
}
if (tt == TokenKind::RightCurly) {
tokenStream.consumeKnownToken(tt);
error(JSMSG_UNEXPECTED_TOKEN, "property name", TokenKindToDesc(tt));
return false;
}

if (tt != TokenKind::LeftParen) {
if (tt != TokenKind::LeftParen && tt != TokenKind::Assign &&
tt != TokenKind::Semi && tt != TokenKind::RightCurly) {
isStatic = true;
} else {
anyChars.ungetToken();
Expand Down
6 changes: 0 additions & 6 deletions js/src/tests/jstests.list
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,6 @@ skip script test262/built-ins/Proxy/create-handler-is-revoked-proxy.js
skip script test262/built-ins/Proxy/create-target-is-revoked-proxy.js
skip script test262/built-ins/Proxy/create-target-is-revoked-function-proxy.js

# https://bugzilla.mozilla.org/show_bug.cgi?id=1629793
skip script test262/language/statements/class/elements/static-as-valid-instance-field-assigned.js
skip script test262/language/statements/class/elements/static-as-valid-instance-field.js
skip script test262/language/expressions/class/elements/static-as-valid-instance-field-assigned.js
skip script test262/language/expressions/class/elements/static-as-valid-instance-field.js


###########################################################
# Tests disabled due to issues in test262 importer script #
Expand Down

0 comments on commit eec403b

Please sign in to comment.