diff --git a/.eslintignore b/.eslintignore
index d14e0cdb..91e18159 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,5 @@
/node_modules
/tests/fixtures
-/tools
+/tools/*
+!/tools/update-ecma-version-tests.js
+/dist
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 27ba0233..93fc39dc 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -4,17 +4,30 @@ module.exports = {
root: true,
extends: "eslint",
env: {
- es6: true
+ es2020: true
+ },
+ parserOptions: {
+ ecmaVersion: 2020,
+ sourceType: "module"
},
overrides: [
{
- files: ["tests/lib/**"],
+ files: ["*.cjs"],
parserOptions: {
- ecmaVersion: 2020
- },
+ sourceType: "script"
+ }
+ },
+ {
+ files: ["tests/lib/**"],
env: {
mocha: true
}
+ },
+ {
+ files: ["tools/**"],
+ rules: {
+ "no-console": "off"
+ }
}
]
};
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b8e18be4..ad3692d7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,3 +6,17 @@ Please sign the [jQuery Foundation Contributor License Agreement](https://contri
Our full contribution guidelines can be found at:
+
+# How to upgrade `acorn` to support new syntax
+
+1. `npm install acorn@latest`
+1. If a new `ecmaVersion` value is added, update `SUPPORTED_VERSIONS` constant in `lib/options.js` and tests in `tests/lib/supported-ecmaversions.js`.
+1. If new token types are added, update `lib/token-translator.js` file to translate the tokens.
+1. Add tests in `tests/fixtures/ecma-version//`.
+ - Add a directory named the new syntax name.
+ - Add `valid-.src.js` files for parseable codes.
+ - Add `invalid-.src.js` files for syntax error codes.
+ - Run `node tools/update-ecma-version-tests.js ` command to generate `.result.js` files.
+ - Check the `.result.js` files are expected results.
+1. Update `README.md`.
+1. Send a pull request.
diff --git a/README.md b/README.md
index f59c074c..6ccbc728 100644
--- a/README.md
+++ b/README.md
@@ -141,7 +141,7 @@ const options = {
tokens: false,
// Set to 3, 5, 6, 7, 8, 9, 10, 11, or 12 to specify the version of ECMAScript syntax you want to use.
- // You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), or 2021 (same as 12) to use the year-based naming.
+ // You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), 2021 (same as 12), or 2022 (same as 13) to use the year-based naming.
// You can also set "latest" (the default) to use the most recently supported version.
ecmaVersion: 5,
@@ -229,12 +229,13 @@ We are building on top of Acorn, however, so that we can contribute back and hel
### What ECMAScript features do you support?
-Espree supports all ECMAScript 2020 features and partially supports ECMAScript 2021 features.
+Espree supports all ECMAScript 2021 features and partially supports ECMAScript 2022 features.
-Because ECMAScript 2021 is still under development, we are implementing features as they are finalized. Currently, Espree supports:
+Because ECMAScript 2022 is still under development, we are implementing features as they are finalized. Currently, Espree supports:
-* [Logical Assignment Operators](https://github.com/tc39/proposal-logical-assignment)
-* [Numeric Separators](https://github.com/tc39/proposal-numeric-separator)
+* [Class instance fields](https://github.com/tc39/proposal-class-fields)
+* [Class private instance methods and accessors](https://github.com/tc39/proposal-private-methods)
+* [Class static fields, static private methods and accessors](https://github.com/tc39/proposal-static-class-features)
See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to know what features are finalized.
diff --git a/lib/options.js b/lib/options.js
index be07f914..434b9a5b 100644
--- a/lib/options.js
+++ b/lib/options.js
@@ -16,7 +16,8 @@ const SUPPORTED_VERSIONS = [
9,
10,
11,
- 12
+ 12,
+ 13
];
/**
diff --git a/lib/token-translator.js b/lib/token-translator.js
index 1e03ae66..9aa5e22e 100644
--- a/lib/token-translator.js
+++ b/lib/token-translator.js
@@ -20,6 +20,7 @@ const Token = {
Boolean: "Boolean",
EOF: "",
Identifier: "Identifier",
+ PrivateIdentifier: "PrivateIdentifier",
Keyword: "Keyword",
Null: "Null",
Numeric: "Numeric",
@@ -114,6 +115,9 @@ TokenTranslator.prototype = {
token.type = Token.Keyword;
}
+ } else if (type === tt.privateId) {
+ token.type = Token.PrivateIdentifier;
+
} else if (type === tt.semi || type === tt.comma ||
type === tt.parenL || type === tt.parenR ||
type === tt.braceL || type === tt.braceR ||
diff --git a/package.json b/package.json
index d0dc31aa..568b83ac 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,7 @@
"dependencies": {
"acorn": "^8.2.2",
"acorn-jsx": "^5.3.1",
- "eslint-visitor-keys": "^2.0.0"
+ "eslint-visitor-keys": "^2.1.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.1.0",
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private-optional.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private-optional.result.js
new file mode 100644
index 00000000..9b503393
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private-optional.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 28,
+ "lineNumber": 3,
+ "column": 11,
+ "message": "Private fields can not be deleted"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private-optional.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private-optional.src.js
new file mode 100644
index 00000000..af84166b
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private-optional.src.js
@@ -0,0 +1,4 @@
+class C {
+ #a;
+ f() { delete this?.#a }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private.result.js
new file mode 100644
index 00000000..9b503393
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 28,
+ "lineNumber": 3,
+ "column": 11,
+ "message": "Private fields can not be deleted"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private.src.js
new file mode 100644
index 00000000..87c0ca40
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-delete-private.src.js
@@ -0,0 +1,4 @@
+class C {
+ #a;
+ f() { delete this.#a }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-init-arguments.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arguments.result.js
new file mode 100644
index 00000000..6704351a
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arguments.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 43,
+ "lineNumber": 3,
+ "column": 15,
+ "message": "Cannot use 'arguments' in class field initializer"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-init-arguments.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arguments.src.js
new file mode 100644
index 00000000..ec2d75c6
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arguments.src.js
@@ -0,0 +1,5 @@
+function f() {
+ class C {
+ aaa = arguments
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-init-arrow-arguments.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arrow-arguments.result.js
new file mode 100644
index 00000000..68b5bd4e
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arrow-arguments.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 49,
+ "lineNumber": 3,
+ "column": 21,
+ "message": "Cannot use 'arguments' in class field initializer"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-init-arrow-arguments.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arrow-arguments.src.js
new file mode 100644
index 00000000..15614ac7
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-init-arrow-arguments.src.js
@@ -0,0 +1,5 @@
+function f() {
+ class C {
+ aaa = () => arguments
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-init-yield.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-init-yield.result.js
new file mode 100644
index 00000000..8065c0aa
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-init-yield.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 333,
+ "lineNumber": 7,
+ "column": 15,
+ "message": "The keyword 'yield' is reserved"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-init-yield.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-init-yield.src.js
new file mode 100644
index 00000000..326b3b99
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-init-yield.src.js
@@ -0,0 +1,9 @@
+function* f() {
+ class C {
+ // `yield` is an identifier reference in field initializers even if it's in a generator function.
+ // But `yield` as identifier references is disallowed in strict mode.
+ // And the inside of classes is always strict mode.
+ // Therefore this is a syntax error.
+ aaa = yield
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-member-private-undef.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-member-private-undef.result.js
new file mode 100644
index 00000000..6a528b4c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-member-private-undef.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 41,
+ "lineNumber": 4,
+ "column": 14,
+ "message": "Private field '#b' must be declared in an enclosing class"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-member-private-undef.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-member-private-undef.src.js
new file mode 100644
index 00000000..f92ef155
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-member-private-undef.src.js
@@ -0,0 +1,6 @@
+class C {
+ #a;
+ f() {
+ this.#b
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-member-super-private.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-member-super-private.result.js
new file mode 100644
index 00000000..511f4c88
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-member-super-private.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 49,
+ "lineNumber": 3,
+ "column": 17,
+ "message": "Unexpected token #foo"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-member-super-private.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-member-super-private.src.js
new file mode 100644
index 00000000..07c20b59
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-member-super-private.src.js
@@ -0,0 +1,4 @@
+class C extends Base {
+ #foo;
+ f() { super.#foo }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-private-constructor.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-private-constructor.result.js
new file mode 100644
index 00000000..c9c25ffb
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-private-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 14,
+ "lineNumber": 2,
+ "column": 5,
+ "message": "Classes can't have an element named '#constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-private-constructor.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-private-constructor.src.js
new file mode 100644
index 00000000..c360f6b6
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-private-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ #constructor = () => {}
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-private-dupelicate.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-private-dupelicate.result.js
new file mode 100644
index 00000000..5e653264
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-private-dupelicate.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 22,
+ "lineNumber": 3,
+ "column": 5,
+ "message": "Identifier '#a' has already been declared"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-private-dupelicate.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-private-dupelicate.src.js
new file mode 100644
index 00000000..9634ef9d
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-private-dupelicate.src.js
@@ -0,0 +1,4 @@
+class C {
+ #a;
+ #a;
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-public-constructor.result.js b/tests/fixtures/ecma-version/13/class-fields/invalid-public-constructor.result.js
new file mode 100644
index 00000000..f399d5a3
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-public-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 14,
+ "lineNumber": 2,
+ "column": 5,
+ "message": "Classes can't have a field named 'constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/invalid-public-constructor.src.js b/tests/fixtures/ecma-version/13/class-fields/invalid-public-constructor.src.js
new file mode 100644
index 00000000..9e81de64
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/invalid-public-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ constructor = () => {}
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.module-result.js b/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.module-result.js
new file mode 100644
index 00000000..821df907
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.module-result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 304,
+ "lineNumber": 6,
+ "column": 15,
+ "message": "Cannot use keyword 'await' outside an async function"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.result.js b/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.result.js
new file mode 100644
index 00000000..8bb610e1
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.result.js
@@ -0,0 +1,442 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 317
+ ],
+ "body": [
+ {
+ "type": "FunctionDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 317
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 15
+ },
+ "end": {
+ "line": 1,
+ "column": 16
+ }
+ },
+ "range": [
+ 15,
+ 16
+ ],
+ "name": "f"
+ },
+ "expression": false,
+ "generator": false,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 19
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 19,
+ 317
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 25,
+ 315
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 31,
+ 32
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 33,
+ 315
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ },
+ "range": [
+ 298,
+ 309
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "range": [
+ 298,
+ 301
+ ],
+ "name": "aaa"
+ },
+ "value": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ },
+ "range": [
+ 304,
+ 309
+ ],
+ "name": "await"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "function",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 14
+ }
+ },
+ "range": [
+ 6,
+ 14
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 15
+ },
+ "end": {
+ "line": 1,
+ "column": 16
+ }
+ },
+ "range": [
+ 15,
+ 16
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 16
+ },
+ "end": {
+ "line": 1,
+ "column": 17
+ }
+ },
+ "range": [
+ 16,
+ 17
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 17
+ },
+ "end": {
+ "line": 1,
+ "column": 18
+ }
+ },
+ "range": [
+ 17,
+ 18
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 19
+ },
+ "end": {
+ "line": 1,
+ "column": 20
+ }
+ },
+ "range": [
+ 19,
+ 20
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 25,
+ 30
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 31,
+ 32
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 33,
+ 34
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "range": [
+ 298,
+ 301
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ },
+ "range": [
+ 302,
+ 303
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "await",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ },
+ "range": [
+ 304,
+ 309
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 314,
+ 315
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 316,
+ 317
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.src.js b/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.src.js
new file mode 100644
index 00000000..c5466e8a
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/mixed-init-await.src.js
@@ -0,0 +1,8 @@
+async function f() {
+ class C {
+ // `await` is an identifier reference in field initializers even if it's in async function body.
+ // But ES modules disallow `await` as identifier references.
+ // Therefore, it's Identifier in script and it's syntax error in module.
+ aaa = await
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-arguments-in-computed-key.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-arguments-in-computed-key.result.js
new file mode 100644
index 00000000..a3217ba9
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-arguments-in-computed-key.result.js
@@ -0,0 +1,461 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 166
+ ],
+ "body": [
+ {
+ "type": "FunctionDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 166
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 9
+ },
+ "end": {
+ "line": 1,
+ "column": 10
+ }
+ },
+ "range": [
+ 9,
+ 10
+ ],
+ "name": "f"
+ },
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 13,
+ 166
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 19,
+ 164
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 27,
+ 164
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 23
+ }
+ },
+ "range": [
+ 143,
+ 158
+ ],
+ "static": false,
+ "computed": true,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 18
+ }
+ },
+ "range": [
+ 144,
+ 153
+ ],
+ "name": "arguments"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 22
+ },
+ "end": {
+ "line": 4,
+ "column": 23
+ }
+ },
+ "range": [
+ 157,
+ 158
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "function",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 8
+ }
+ },
+ "range": [
+ 0,
+ 8
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 9
+ },
+ "end": {
+ "line": 1,
+ "column": 10
+ }
+ },
+ "range": [
+ 9,
+ 10
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 10
+ },
+ "end": {
+ "line": 1,
+ "column": 11
+ }
+ },
+ "range": [
+ 10,
+ 11
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 11
+ },
+ "end": {
+ "line": 1,
+ "column": 12
+ }
+ },
+ "range": [
+ 11,
+ 12
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 13
+ },
+ "end": {
+ "line": 1,
+ "column": 14
+ }
+ },
+ "range": [
+ 13,
+ 14
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 19,
+ 24
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 27,
+ 28
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "[",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 143,
+ 144
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "arguments",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 18
+ }
+ },
+ "range": [
+ 144,
+ 153
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "]",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 18
+ },
+ "end": {
+ "line": 4,
+ "column": 19
+ }
+ },
+ "range": [
+ 153,
+ 154
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 20
+ },
+ "end": {
+ "line": 4,
+ "column": 21
+ }
+ },
+ "range": [
+ 155,
+ 156
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 22
+ },
+ "end": {
+ "line": 4,
+ "column": 23
+ }
+ },
+ "range": [
+ 157,
+ 158
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 163,
+ 164
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 165,
+ 166
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-arguments-in-computed-key.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-arguments-in-computed-key.src.js
new file mode 100644
index 00000000..1b4db221
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-arguments-in-computed-key.src.js
@@ -0,0 +1,6 @@
+function f() {
+ class C {
+ // `arguments` in computed keys is allowed (on the other hand, disallowed in field initializers).
+ [arguments] = 0
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-async-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-async-asi.result.js
new file mode 100644
index 00000000..1757b8a8
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-async-asi.result.js
@@ -0,0 +1,373 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 98
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 98
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 98
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 85,
+ 96
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 85,
+ 91
+ ],
+ "name": "method"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 91,
+ 96
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 94,
+ 96
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "method",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 85,
+ 91
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 91,
+ 92
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 92,
+ 93
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 14
+ }
+ },
+ "range": [
+ 94,
+ 95
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 95,
+ 96
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 97,
+ 98
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-async-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-async-asi.src.js
new file mode 100644
index 00000000..49f07272
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-async-asi.src.js
@@ -0,0 +1,5 @@
+class C {
+ // Line breaks preceded by `async` create fields by ASI.
+ async
+ method() {}
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-computed-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-computed-asi.result.js
new file mode 100644
index 00000000..4f44c719
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-computed-asi.result.js
@@ -0,0 +1,559 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 133
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 133
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 133
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 91,
+ 94
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 91,
+ 94
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 99,
+ 106
+ ],
+ "static": false,
+ "computed": true,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 100,
+ 105
+ ],
+ "value": "bbb",
+ "raw": "\"bbb\""
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "range": [
+ 112,
+ 115
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "range": [
+ 112,
+ 115
+ ],
+ "name": "ccc"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "range": [
+ 120,
+ 131
+ ],
+ "static": false,
+ "computed": true,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 5
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 121,
+ 126
+ ],
+ "value": "ddd",
+ "raw": "\"ddd\""
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 11
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "range": [
+ 127,
+ 131
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 13
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "range": [
+ 129,
+ 131
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 91,
+ 94
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "[",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 5
+ }
+ },
+ "range": [
+ 99,
+ 100
+ ]
+ },
+ {
+ "type": "String",
+ "value": "\"bbb\"",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 100,
+ 105
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "]",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 105,
+ 106
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "ccc",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "range": [
+ 112,
+ 115
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "[",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 120,
+ 121
+ ]
+ },
+ {
+ "type": "String",
+ "value": "\"ddd\"",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 5
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 121,
+ 126
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "]",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 10
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 126,
+ 127
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 11
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 127,
+ 128
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "range": [
+ 128,
+ 129
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 13
+ },
+ "end": {
+ "line": 7,
+ "column": 14
+ }
+ },
+ "range": [
+ 129,
+ 130
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "range": [
+ 130,
+ 131
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 132,
+ 133
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-computed-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-computed-asi.src.js
new file mode 100644
index 00000000..36dc8056
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-computed-asi.src.js
@@ -0,0 +1,8 @@
+class C {
+ // Line breaks make fields by ASI. (there are three fields and a method)
+ aaa
+ ["bbb"]
+
+ ccc
+ ["ddd"](){}
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-computed-no-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-computed-no-asi.result.js
new file mode 100644
index 00000000..e5ac4f59
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-computed-no-asi.result.js
@@ -0,0 +1,444 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 80
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 80
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 80
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 59,
+ 78
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 59,
+ 62
+ ],
+ "name": "aaa"
+ },
+ "value": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 65,
+ 78
+ ],
+ "object": {
+ "type": "ObjectExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 13
+ }
+ },
+ "range": [
+ 65,
+ 68
+ ],
+ "properties": [
+ {
+ "type": "Property",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 66,
+ 67
+ ],
+ "method": false,
+ "shorthand": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 66,
+ 67
+ ],
+ "name": "f"
+ },
+ "kind": "init",
+ "value": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 66,
+ 67
+ ],
+ "name": "f"
+ }
+ }
+ ]
+ },
+ "property": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 74,
+ 77
+ ],
+ "value": "f",
+ "raw": "\"f\""
+ },
+ "computed": true,
+ "optional": false
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 59,
+ 62
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 63,
+ 64
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 65,
+ 66
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 66,
+ 67
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 12
+ },
+ "end": {
+ "line": 3,
+ "column": 13
+ }
+ },
+ "range": [
+ 67,
+ 68
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "[",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 5
+ }
+ },
+ "range": [
+ 73,
+ 74
+ ]
+ },
+ {
+ "type": "String",
+ "value": "\"f\"",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 74,
+ 77
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "]",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 77,
+ 78
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 79,
+ 80
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-computed-no-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-computed-no-asi.src.js
new file mode 100644
index 00000000..f2175dc8
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-computed-no-asi.src.js
@@ -0,0 +1,5 @@
+class C {
+ // This is `{f}["f"]` member expression.
+ aaa = {f}
+ ["f"]
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-computed.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-computed.result.js
new file mode 100644
index 00000000..6d14f563
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-computed.result.js
@@ -0,0 +1,260 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 22
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 22
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 22
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "range": [
+ 14,
+ 20
+ ],
+ "static": false,
+ "computed": true,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 5
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 15,
+ 18
+ ],
+ "value": "a",
+ "raw": "\"a\""
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "[",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 5
+ }
+ },
+ "range": [
+ 14,
+ 15
+ ]
+ },
+ {
+ "type": "String",
+ "value": "\"a\"",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 5
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 15,
+ 18
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "]",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 19
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 9
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "range": [
+ 19,
+ 20
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 21,
+ 22
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-computed.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-computed.src.js
new file mode 100644
index 00000000..66c98d27
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-computed.src.js
@@ -0,0 +1,3 @@
+class C {
+ ["a"];
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords-init.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords-init.result.js
new file mode 100644
index 00000000..2d37bbaa
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords-init.result.js
@@ -0,0 +1,661 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 68
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 68
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 68
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 14,
+ 22
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "name": "get"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 20,
+ 21
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 27,
+ 35
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 27,
+ 30
+ ],
+ "name": "set"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 33,
+ 34
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 40,
+ 51
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 40,
+ 46
+ ],
+ "name": "static"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 14
+ }
+ },
+ "range": [
+ 49,
+ 50
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 14
+ }
+ },
+ "range": [
+ 56,
+ 66
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 9
+ }
+ },
+ "range": [
+ 56,
+ 61
+ ],
+ "name": "async"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 13
+ }
+ },
+ "range": [
+ 64,
+ 65
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 19
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 20,
+ 21
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 21,
+ 22
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 27,
+ 30
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 31,
+ 32
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 33,
+ 34
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 34,
+ 35
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 40,
+ 46
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 47,
+ 48
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 14
+ }
+ },
+ "range": [
+ 49,
+ 50
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 50,
+ 51
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 9
+ }
+ },
+ "range": [
+ 56,
+ 61
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 10
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "range": [
+ 62,
+ 63
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 13
+ }
+ },
+ "range": [
+ 64,
+ 65
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 14
+ }
+ },
+ "range": [
+ 65,
+ 66
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 67,
+ 68
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords-init.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords-init.src.js
new file mode 100644
index 00000000..43bb5fa9
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords-init.src.js
@@ -0,0 +1,6 @@
+class C {
+ get = 0;
+ set = 0;
+ static = 0;
+ async = 0;
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords.result.js
new file mode 100644
index 00000000..450c243e
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords.result.js
@@ -0,0 +1,445 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 52
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 52
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 52
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 14,
+ 18
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "name": "get"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ },
+ "range": [
+ 23,
+ 27
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 23,
+ 26
+ ],
+ "name": "set"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 32,
+ 39
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 32,
+ 38
+ ],
+ "name": "static"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 44,
+ 50
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 9
+ }
+ },
+ "range": [
+ 44,
+ 49
+ ],
+ "name": "async"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 7
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 17,
+ 18
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 23,
+ 26
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 32,
+ 38
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 38,
+ 39
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 9
+ }
+ },
+ "range": [
+ 44,
+ 49
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 49,
+ 50
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 51,
+ 52
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords.src.js
new file mode 100644
index 00000000..d47e822c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-contextual-keywords.src.js
@@ -0,0 +1,6 @@
+class C {
+ get;
+ set;
+ static;
+ async;
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-get-set-star-no-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-get-set-star-no-asi.result.js
new file mode 100644
index 00000000..95d02bab
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-get-set-star-no-asi.result.js
@@ -0,0 +1,744 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 118
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 118
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 118
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 59,
+ 74
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 67,
+ 70
+ ],
+ "name": "get"
+ },
+ "kind": "get",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 7
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 70,
+ 74
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 72,
+ 74
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 80,
+ 96
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 7
+ }
+ },
+ "range": [
+ 88,
+ 91
+ ],
+ "name": "set"
+ },
+ "kind": "set",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 7
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 91,
+ 96
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "range": [
+ 92,
+ 93
+ ],
+ "name": "x"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 10
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 94,
+ 96
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "range": [
+ 102,
+ 116
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "range": [
+ 108,
+ 112
+ ],
+ "name": "star"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "range": [
+ 112,
+ 116
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 10
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "range": [
+ 114,
+ 116
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 59,
+ 62
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 67,
+ 70
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 7
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 70,
+ 71
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 71,
+ 72
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 72,
+ 73
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 73,
+ 74
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "range": [
+ 80,
+ 83
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 7
+ }
+ },
+ "range": [
+ 88,
+ 91
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 7
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "range": [
+ 91,
+ 92
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "range": [
+ 92,
+ 93
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 9
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 93,
+ 94
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 10
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 94,
+ 95
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 11
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 95,
+ 96
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "range": [
+ 102,
+ 103
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "star",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "range": [
+ 108,
+ 112
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 9
+ }
+ },
+ "range": [
+ 112,
+ 113
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 9
+ },
+ "end": {
+ "line": 10,
+ "column": 10
+ }
+ },
+ "range": [
+ 113,
+ 114
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 10
+ },
+ "end": {
+ "line": 10,
+ "column": 11
+ }
+ },
+ "range": [
+ 114,
+ 115
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "range": [
+ 115,
+ 116
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 117,
+ 118
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-get-set-star-no-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-get-set-star-no-asi.src.js
new file mode 100644
index 00000000..f13ac182
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-get-set-star-no-asi.src.js
@@ -0,0 +1,11 @@
+class C {
+ // Line breaks don't make fields by ASI.
+ get
+ get(){}
+
+ set
+ set(x){}
+
+ *
+ star(){}
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-arguments.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-arguments.result.js
new file mode 100644
index 00000000..088f7e92
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-arguments.result.js
@@ -0,0 +1,572 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 198
+ ],
+ "body": [
+ {
+ "type": "FunctionDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 198
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 9
+ },
+ "end": {
+ "line": 1,
+ "column": 10
+ }
+ },
+ "range": [
+ 9,
+ 10
+ ],
+ "name": "f"
+ },
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 13
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 13,
+ 198
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 19,
+ 196
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 27,
+ 196
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 140,
+ 190
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 140,
+ 143
+ ],
+ "name": "aaa"
+ },
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 146,
+ 190
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 25
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 157,
+ 190
+ ],
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 21
+ }
+ },
+ "range": [
+ 171,
+ 180
+ ],
+ "expression": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 21
+ }
+ },
+ "range": [
+ 171,
+ 180
+ ],
+ "name": "arguments"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "function",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 8
+ }
+ },
+ "range": [
+ 0,
+ 8
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 9
+ },
+ "end": {
+ "line": 1,
+ "column": 10
+ }
+ },
+ "range": [
+ 9,
+ 10
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 10
+ },
+ "end": {
+ "line": 1,
+ "column": 11
+ }
+ },
+ "range": [
+ 10,
+ 11
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 11
+ },
+ "end": {
+ "line": 1,
+ "column": 12
+ }
+ },
+ "range": [
+ 11,
+ 12
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 13
+ },
+ "end": {
+ "line": 1,
+ "column": 14
+ }
+ },
+ "range": [
+ 13,
+ 14
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 19,
+ 24
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 27,
+ 28
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 140,
+ 143
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 13
+ }
+ },
+ "range": [
+ 144,
+ 145
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "function",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 4,
+ "column": 22
+ }
+ },
+ "range": [
+ 146,
+ 154
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 22
+ },
+ "end": {
+ "line": 4,
+ "column": 23
+ }
+ },
+ "range": [
+ 154,
+ 155
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 23
+ },
+ "end": {
+ "line": 4,
+ "column": 24
+ }
+ },
+ "range": [
+ 155,
+ 156
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 25
+ },
+ "end": {
+ "line": 4,
+ "column": 26
+ }
+ },
+ "range": [
+ 157,
+ 158
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "arguments",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 21
+ }
+ },
+ "range": [
+ 171,
+ 180
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 189,
+ 190
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 195,
+ 196
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 197,
+ 198
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-arguments.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-arguments.src.js
new file mode 100644
index 00000000..946a705a
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-arguments.src.js
@@ -0,0 +1,8 @@
+function f() {
+ class C {
+ // Field initializers disallow `arguments` reference, but it's OK in function expression body.
+ aaa = function() {
+ arguments
+ }
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow-super.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow-super.result.js
new file mode 100644
index 00000000..85753e4c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow-super.result.js
@@ -0,0 +1,461 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 49
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 49
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 49
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 37
+ }
+ },
+ "range": [
+ 14,
+ 47
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 14,
+ 22
+ ],
+ "name": "toString"
+ },
+ "value": {
+ "type": "ArrowFunctionExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 37
+ }
+ },
+ "range": [
+ 25,
+ 47
+ ],
+ "id": null,
+ "expression": true,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "CallExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 37
+ }
+ },
+ "range": [
+ 31,
+ 47
+ ],
+ "callee": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 35
+ }
+ },
+ "range": [
+ 31,
+ 45
+ ],
+ "object": {
+ "type": "Super",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 26
+ }
+ },
+ "range": [
+ 31,
+ 36
+ ]
+ },
+ "property": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 27
+ },
+ "end": {
+ "line": 2,
+ "column": 35
+ }
+ },
+ "range": [
+ 37,
+ 45
+ ],
+ "name": "toString"
+ },
+ "computed": false,
+ "optional": false
+ },
+ "arguments": [],
+ "optional": false
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "toString",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 14,
+ 22
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 13
+ },
+ "end": {
+ "line": 2,
+ "column": 14
+ }
+ },
+ "range": [
+ 23,
+ 24
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 16
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=>",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 18
+ },
+ "end": {
+ "line": 2,
+ "column": 20
+ }
+ },
+ "range": [
+ 28,
+ 30
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "super",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 26
+ }
+ },
+ "range": [
+ 31,
+ 36
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 26
+ },
+ "end": {
+ "line": 2,
+ "column": 27
+ }
+ },
+ "range": [
+ 36,
+ 37
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "toString",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 27
+ },
+ "end": {
+ "line": 2,
+ "column": 35
+ }
+ },
+ "range": [
+ 37,
+ 45
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 35
+ },
+ "end": {
+ "line": 2,
+ "column": 36
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 36
+ },
+ "end": {
+ "line": 2,
+ "column": 37
+ }
+ },
+ "range": [
+ 46,
+ 47
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 48,
+ 49
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow-super.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow-super.src.js
new file mode 100644
index 00000000..815789f4
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow-super.src.js
@@ -0,0 +1,3 @@
+class C {
+ toString = () => super.toString()
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow.result.js
new file mode 100644
index 00000000..61a21fcf
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow.result.js
@@ -0,0 +1,335 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 29
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 29
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 29
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 14,
+ 27
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "name": "aaa"
+ },
+ "value": {
+ "type": "ArrowFunctionExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 20,
+ 27
+ ],
+ "id": null,
+ "expression": true,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 16
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 19
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 20,
+ 21
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 21,
+ 22
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=>",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 13
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 23,
+ 25
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 16
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 28,
+ 29
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow.src.js
new file mode 100644
index 00000000..32cf142e
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-arrow.src.js
@@ -0,0 +1,3 @@
+class C {
+ aaa = () => 0
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-super.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-super.result.js
new file mode 100644
index 00000000..9e688158
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-super.result.js
@@ -0,0 +1,330 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 126
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 126
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 126
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 104,
+ 124
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 104,
+ 107
+ ],
+ "name": "aaa"
+ },
+ "value": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 110,
+ 124
+ ],
+ "object": {
+ "type": "Super",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 15
+ }
+ },
+ "range": [
+ 110,
+ 115
+ ]
+ },
+ "property": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 116,
+ 124
+ ],
+ "name": "toString"
+ },
+ "computed": false,
+ "optional": false
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 104,
+ 107
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 108,
+ 109
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "super",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 15
+ }
+ },
+ "range": [
+ 110,
+ 115
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 115,
+ 116
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "toString",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 116,
+ 124
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 125,
+ 126
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-init-super.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-init-super.src.js
new file mode 100644
index 00000000..6c843d52
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-init-super.src.js
@@ -0,0 +1,4 @@
+class C {
+ // Field initializers allow `super` properties even if it's outside of any functions.
+ aaa = super.toString
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting-use-first.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting-use-first.result.js
new file mode 100644
index 00000000..e1fe0f52
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting-use-first.result.js
@@ -0,0 +1,993 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 181
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 181
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 11
+ }
+ },
+ "range": [
+ 6,
+ 11
+ ],
+ "name": "Outer"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 12
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 12,
+ 181
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 5
+ }
+ },
+ "range": [
+ 18,
+ 171
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 23
+ ],
+ "name": "Inner"
+ },
+ "value": {
+ "type": "ClassExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 8,
+ "column": 5
+ }
+ },
+ "range": [
+ 26,
+ 171
+ ],
+ "id": null,
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 18
+ },
+ "end": {
+ "line": 8,
+ "column": 5
+ }
+ },
+ "range": [
+ 32,
+ 171
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 42,
+ 153
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 42,
+ 43
+ ],
+ "name": "f"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 43,
+ 153
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 44,
+ 45
+ ],
+ "name": "x"
+ },
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 47,
+ 48
+ ],
+ "name": "y"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 50,
+ 153
+ ],
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 23
+ }
+ },
+ "range": [
+ 132,
+ 143
+ ],
+ "expression": {
+ "type": "BinaryExpression",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 23
+ }
+ },
+ "range": [
+ 132,
+ 143
+ ],
+ "left": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 132,
+ 136
+ ],
+ "object": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 13
+ }
+ },
+ "range": [
+ 132,
+ 133
+ ],
+ "name": "x"
+ },
+ "property": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 14
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 134,
+ 136
+ ],
+ "name": "a"
+ },
+ "computed": false,
+ "optional": false
+ },
+ "operator": "+",
+ "right": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 23
+ }
+ },
+ "range": [
+ 139,
+ 143
+ ],
+ "object": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 20
+ }
+ },
+ "range": [
+ 139,
+ 140
+ ],
+ "name": "y"
+ },
+ "property": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 21
+ },
+ "end": {
+ "line": 5,
+ "column": 23
+ }
+ },
+ "range": [
+ 141,
+ 143
+ ],
+ "name": "b"
+ },
+ "computed": false,
+ "optional": false
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 162,
+ 165
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 162,
+ 164
+ ],
+ "name": "b"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 7
+ }
+ },
+ "range": [
+ 176,
+ 179
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 6
+ }
+ },
+ "range": [
+ 176,
+ 178
+ ],
+ "name": "a"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "Outer",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 11
+ }
+ },
+ "range": [
+ 6,
+ 11
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 12
+ },
+ "end": {
+ "line": 1,
+ "column": 13
+ }
+ },
+ "range": [
+ 12,
+ 13
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "Inner",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 23
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 24,
+ 25
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 31
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 18
+ },
+ "end": {
+ "line": 2,
+ "column": 19
+ }
+ },
+ "range": [
+ 32,
+ 33
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 42,
+ 43
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 43,
+ 44
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 44,
+ 45
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ",",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "y",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 47,
+ 48
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 14
+ },
+ "end": {
+ "line": 3,
+ "column": 15
+ }
+ },
+ "range": [
+ 48,
+ 49
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 17
+ }
+ },
+ "range": [
+ 50,
+ 51
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 13
+ }
+ },
+ "range": [
+ 132,
+ 133
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 14
+ }
+ },
+ "range": [
+ 133,
+ 134
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "a",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 14
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 134,
+ 136
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "+",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 17
+ },
+ "end": {
+ "line": 5,
+ "column": 18
+ }
+ },
+ "range": [
+ 137,
+ 138
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "y",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 19
+ },
+ "end": {
+ "line": 5,
+ "column": 20
+ }
+ },
+ "range": [
+ 139,
+ 140
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 20
+ },
+ "end": {
+ "line": 5,
+ "column": 21
+ }
+ },
+ "range": [
+ 140,
+ 141
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "b",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 21
+ },
+ "end": {
+ "line": 5,
+ "column": 23
+ }
+ },
+ "range": [
+ 141,
+ 143
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 152,
+ 153
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "b",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 162,
+ 164
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 10
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 164,
+ 165
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 5
+ }
+ },
+ "range": [
+ 170,
+ 171
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "a",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 6
+ }
+ },
+ "range": [
+ 176,
+ 178
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 6
+ },
+ "end": {
+ "line": 9,
+ "column": 7
+ }
+ },
+ "range": [
+ 178,
+ 179
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 180,
+ 181
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting-use-first.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting-use-first.src.js
new file mode 100644
index 00000000..c90f1332
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting-use-first.src.js
@@ -0,0 +1,10 @@
+class Outer {
+ Inner = class {
+ f(x, y) {
+ // OK even if the private fields are defined after use.
+ x.#a + y.#b
+ }
+ #b;
+ }
+ #a;
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting.result.js
new file mode 100644
index 00000000..d622b958
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting.result.js
@@ -0,0 +1,993 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 182
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 182
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 11
+ }
+ },
+ "range": [
+ 6,
+ 11
+ ],
+ "name": "Outer"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 12
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 12,
+ 182
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 87,
+ 90
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ },
+ "range": [
+ 87,
+ 89
+ ],
+ "name": "a"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "range": [
+ 95,
+ 180
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 95,
+ 100
+ ],
+ "name": "Inner"
+ },
+ "value": {
+ "type": "ClassExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 12
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "range": [
+ 103,
+ 180
+ ],
+ "id": null,
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 18
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "range": [
+ 109,
+ 180
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "range": [
+ 119,
+ 122
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 119,
+ 121
+ ],
+ "name": "b"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 131,
+ 174
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 131,
+ 132
+ ],
+ "name": "f"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 9
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 132,
+ 174
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 10
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "range": [
+ 133,
+ 134
+ ],
+ "name": "x"
+ },
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ },
+ "range": [
+ 136,
+ 137
+ ],
+ "name": "y"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 16
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 139,
+ 174
+ ],
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "range": [
+ 153,
+ 164
+ ],
+ "expression": {
+ "type": "BinaryExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "range": [
+ 153,
+ 164
+ ],
+ "left": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 153,
+ 157
+ ],
+ "object": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "range": [
+ 153,
+ 154
+ ],
+ "name": "x"
+ },
+ "property": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 155,
+ 157
+ ],
+ "name": "a"
+ },
+ "computed": false,
+ "optional": false
+ },
+ "operator": "+",
+ "right": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 19
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "range": [
+ 160,
+ 164
+ ],
+ "object": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 19
+ },
+ "end": {
+ "line": 7,
+ "column": 20
+ }
+ },
+ "range": [
+ 160,
+ 161
+ ],
+ "name": "y"
+ },
+ "property": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 21
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "range": [
+ 162,
+ 164
+ ],
+ "name": "b"
+ },
+ "computed": false,
+ "optional": false
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "Outer",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 11
+ }
+ },
+ "range": [
+ 6,
+ 11
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 12
+ },
+ "end": {
+ "line": 1,
+ "column": 13
+ }
+ },
+ "range": [
+ 12,
+ 13
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "a",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ },
+ "range": [
+ 87,
+ 89
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 6
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 89,
+ 90
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "Inner",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 95,
+ 100
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 101,
+ 102
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 17
+ }
+ },
+ "range": [
+ 103,
+ 108
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 18
+ },
+ "end": {
+ "line": 4,
+ "column": 19
+ }
+ },
+ "range": [
+ 109,
+ 110
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "b",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 119,
+ 121
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 10
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "range": [
+ 121,
+ 122
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 131,
+ 132
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 132,
+ 133
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 10
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "range": [
+ 133,
+ 134
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ",",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 11
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ },
+ "range": [
+ 134,
+ 135
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "y",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ },
+ "range": [
+ 136,
+ 137
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 15
+ }
+ },
+ "range": [
+ 137,
+ 138
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 16
+ },
+ "end": {
+ "line": 6,
+ "column": 17
+ }
+ },
+ "range": [
+ 139,
+ 140
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "range": [
+ 153,
+ 154
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 13
+ },
+ "end": {
+ "line": 7,
+ "column": 14
+ }
+ },
+ "range": [
+ 154,
+ 155
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "a",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 155,
+ 157
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "+",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 17
+ },
+ "end": {
+ "line": 7,
+ "column": 18
+ }
+ },
+ "range": [
+ 158,
+ 159
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "y",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 19
+ },
+ "end": {
+ "line": 7,
+ "column": 20
+ }
+ },
+ "range": [
+ 160,
+ 161
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 20
+ },
+ "end": {
+ "line": 7,
+ "column": 21
+ }
+ },
+ "range": [
+ 161,
+ 162
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "b",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 21
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "range": [
+ 162,
+ 164
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 173,
+ 174
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "range": [
+ 179,
+ 180
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 1
+ }
+ },
+ "range": [
+ 181,
+ 182
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting.src.js
new file mode 100644
index 00000000..d1cd08e0
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-member-private-nesting.src.js
@@ -0,0 +1,10 @@
+class Outer {
+ // Inner classes can access the private fields of outer classes.
+ #a;
+ Inner = class {
+ #b;
+ f(x, y) {
+ x.#a + y.#b
+ }
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-member-private.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-member-private.result.js
new file mode 100644
index 00000000..6dd762ab
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-member-private.result.js
@@ -0,0 +1,517 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 51
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 51
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 51
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 6
+ }
+ },
+ "range": [
+ 14,
+ 16
+ ],
+ "name": "a"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 22,
+ 49
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 5
+ }
+ },
+ "range": [
+ 22,
+ 23
+ ],
+ "name": "f"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 5
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 23,
+ 49
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 26,
+ 49
+ ],
+ "body": [
+ {
+ "type": "ExpressionStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 36,
+ 43
+ ],
+ "expression": {
+ "type": "MemberExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 36,
+ 43
+ ],
+ "object": {
+ "type": "ThisExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ]
+ },
+ "property": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 41,
+ 43
+ ],
+ "name": "a"
+ },
+ "computed": false,
+ "optional": false
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "a",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 6
+ }
+ },
+ "range": [
+ 14,
+ 16
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 6
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 16,
+ 17
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 5
+ }
+ },
+ "range": [
+ 22,
+ 23
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 5
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ },
+ "range": [
+ 23,
+ 24
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 6
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 24,
+ 25
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "this",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ".",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 13
+ }
+ },
+ "range": [
+ 40,
+ 41
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "a",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 41,
+ 43
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "range": [
+ 48,
+ 49
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 50,
+ 51
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-member-private.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-member-private.src.js
new file mode 100644
index 00000000..0ebd993f
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-member-private.src.js
@@ -0,0 +1,6 @@
+class C {
+ #a;
+ f() {
+ this.#a
+ }
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-private-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-private-asi.result.js
new file mode 100644
index 00000000..829e04f2
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-private-asi.result.js
@@ -0,0 +1,371 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 42
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 42
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 42
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 14,
+ 18
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 14,
+ 18
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 23,
+ 31
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ },
+ "range": [
+ 23,
+ 27
+ ],
+ "name": "bbb"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 30,
+ 31
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ],
+ "name": "ccc"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 14,
+ 18
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "bbb",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ },
+ "range": [
+ 23,
+ 27
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 9
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 28,
+ 29
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 30,
+ 31
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "ccc",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 41,
+ 42
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-private-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-private-asi.src.js
new file mode 100644
index 00000000..873abc17
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-private-asi.src.js
@@ -0,0 +1,5 @@
+class C {
+ #aaa
+ #bbb = 0
+ #ccc
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-private.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-private.result.js
new file mode 100644
index 00000000..f3f5be9c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-private.result.js
@@ -0,0 +1,223 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 21
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 21
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 21
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 14,
+ 19
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 14,
+ 18
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 8
+ }
+ },
+ "range": [
+ 14,
+ 18
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 19
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 20,
+ 21
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-private.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-private.src.js
new file mode 100644
index 00000000..4351b5cc
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-private.src.js
@@ -0,0 +1,3 @@
+class C {
+ #aaa;
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-prototype.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-prototype.result.js
new file mode 100644
index 00000000..768fea17
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-prototype.result.js
@@ -0,0 +1,259 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 29
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 29
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 29
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 14,
+ 27
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 14,
+ 23
+ ],
+ "name": "prototype"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 16
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "prototype",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 14,
+ 23
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 14
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 24,
+ 25
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 16
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 0
+ },
+ "end": {
+ "line": 3,
+ "column": 1
+ }
+ },
+ "range": [
+ 28,
+ 29
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-prototype.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-prototype.src.js
new file mode 100644
index 00000000..c38df329
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-prototype.src.js
@@ -0,0 +1,3 @@
+class C {
+ prototype = 0
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-public-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-public-asi.result.js
new file mode 100644
index 00000000..2656721b
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-public-asi.result.js
@@ -0,0 +1,371 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 39
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 39
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 39
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 22,
+ 29
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 22,
+ 25
+ ],
+ "name": "bbb"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 28,
+ 29
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 34,
+ 37
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 34,
+ 37
+ ],
+ "name": "ccc"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "bbb",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 22,
+ 25
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 28,
+ 29
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "ccc",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 34,
+ 37
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 38,
+ 39
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-public-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-public-asi.src.js
new file mode 100644
index 00000000..bcada874
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-public-asi.src.js
@@ -0,0 +1,5 @@
+class C {
+ aaa
+ bbb = 0
+ ccc
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-public.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-public.result.js
new file mode 100644
index 00000000..19b4f2aa
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-public.result.js
@@ -0,0 +1,223 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 81
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 81
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 81
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ },
+ "range": [
+ 75,
+ 79
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 75,
+ 78
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 75,
+ 78
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 8
+ }
+ },
+ "range": [
+ 78,
+ 79
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 80,
+ 81
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-public.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-public.src.js
new file mode 100644
index 00000000..2838d1ed
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-public.src.js
@@ -0,0 +1,4 @@
+class C {
+ // Semicolon is in the range of PropertyDefinition node.
+ aaa;
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names-init.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names-init.result.js
new file mode 100644
index 00000000..d0fb9081
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names-init.result.js
@@ -0,0 +1,704 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 83
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 83
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 83
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 14,
+ 21
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "value": 1000,
+ "raw": "1e3"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 20,
+ 21
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 26,
+ 38
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 26,
+ 34
+ ],
+ "value": "double",
+ "raw": "\"double\""
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 37,
+ 38
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 43,
+ 55
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 43,
+ 51
+ ],
+ "value": "single",
+ "raw": "'single'"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 15
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 54,
+ 55
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 60,
+ 66
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "range": [
+ 60,
+ 62
+ ],
+ "value": 1n,
+ "raw": "1n",
+ "bigint": "1"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 65,
+ 66
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ },
+ "range": [
+ 71,
+ 81
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 71,
+ 77
+ ],
+ "name": "A"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ },
+ "range": [
+ 80,
+ 81
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "1e3",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 9
+ }
+ },
+ "range": [
+ 18,
+ 19
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 20,
+ 21
+ ]
+ },
+ {
+ "type": "String",
+ "value": "\"double\"",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 26,
+ 34
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 35,
+ 36
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 37,
+ 38
+ ]
+ },
+ {
+ "type": "String",
+ "value": "'single'",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 43,
+ 51
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 14
+ }
+ },
+ "range": [
+ 52,
+ 53
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 15
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 54,
+ 55
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "1n",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "range": [
+ 60,
+ 62
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 7
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "range": [
+ 63,
+ 64
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 65,
+ 66
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "A",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 71,
+ 77
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 11
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ },
+ "range": [
+ 78,
+ 79
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ },
+ "range": [
+ 80,
+ 81
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 82,
+ 83
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names-init.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names-init.src.js
new file mode 100644
index 00000000..1b21a82c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names-init.src.js
@@ -0,0 +1,7 @@
+class C {
+ 1e3 = 0
+ "double" = 0
+ 'single' = 0
+ 1n = 0
+ \u0041 = 0
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names.result.js
new file mode 100644
index 00000000..e795e89c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names.result.js
@@ -0,0 +1,434 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 63
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 63
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 63
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ],
+ "value": 1000,
+ "raw": "1e3"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 22,
+ 30
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 22,
+ 30
+ ],
+ "value": "double",
+ "raw": "\"double\""
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 35,
+ 43
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 35,
+ 43
+ ],
+ "value": "single",
+ "raw": "'single'"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "range": [
+ 48,
+ 50
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "range": [
+ 48,
+ 50
+ ],
+ "value": 1n,
+ "raw": "1n",
+ "bigint": "1"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 55,
+ 61
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 55,
+ 61
+ ],
+ "name": "A"
+ },
+ "value": null
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "1e3",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "String",
+ "value": "\"double\"",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 22,
+ 30
+ ]
+ },
+ {
+ "type": "String",
+ "value": "'single'",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 35,
+ 43
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "1n",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "range": [
+ 48,
+ 50
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "A",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 55,
+ 61
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 1
+ }
+ },
+ "range": [
+ 62,
+ 63
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names.src.js
new file mode 100644
index 00000000..c6b427c3
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-special-field-names.src.js
@@ -0,0 +1,7 @@
+class C {
+ 1e3
+ "double"
+ 'single'
+ 1n
+ \u0041
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-star-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-star-asi.result.js
new file mode 100644
index 00000000..29496308
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-star-asi.result.js
@@ -0,0 +1,391 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 71
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 71
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 71
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 55,
+ 58
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 55,
+ 58
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 63,
+ 69
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 6
+ }
+ },
+ "range": [
+ 64,
+ 65
+ ],
+ "name": "f"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 6
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 65,
+ 69
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 67,
+ 69
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 55,
+ 58
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 5
+ }
+ },
+ "range": [
+ 63,
+ 64
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 6
+ }
+ },
+ "range": [
+ 64,
+ 65
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 6
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 65,
+ 66
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 7
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 66,
+ 67
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 67,
+ 68
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 68,
+ 69
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 70,
+ 71
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-star-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-star-asi.src.js
new file mode 100644
index 00000000..27b2b8ef
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-star-asi.src.js
@@ -0,0 +1,5 @@
+class C {
+ // Line breaks create fields by ASI.
+ aaa
+ *f(){}
+}
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-star-no-asi.result.js b/tests/fixtures/ecma-version/13/class-fields/valid-star-no-asi.result.js
new file mode 100644
index 00000000..f8ad6c33
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-star-no-asi.result.js
@@ -0,0 +1,386 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 57
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 57
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 57
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 39,
+ 55
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 39,
+ 42
+ ],
+ "name": "aaa"
+ },
+ "value": {
+ "type": "BinaryExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 45,
+ 55
+ ],
+ "left": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ],
+ "value": 2,
+ "raw": "2"
+ },
+ "operator": "*",
+ "right": {
+ "type": "CallExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 52,
+ 55
+ ],
+ "callee": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 6
+ }
+ },
+ "range": [
+ 52,
+ 53
+ ],
+ "name": "f"
+ },
+ "arguments": [],
+ "optional": false
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 39,
+ 42
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 43,
+ 44
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "2",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 11
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 5
+ }
+ },
+ "range": [
+ 51,
+ 52
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "f",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 5
+ },
+ "end": {
+ "line": 4,
+ "column": 6
+ }
+ },
+ "range": [
+ 52,
+ 53
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 6
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 53,
+ 54
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 7
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 54,
+ 55
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 1
+ }
+ },
+ "range": [
+ 56,
+ 57
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/class-fields/valid-star-no-asi.src.js b/tests/fixtures/ecma-version/13/class-fields/valid-star-no-asi.src.js
new file mode 100644
index 00000000..4eec00e2
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/class-fields/valid-star-no-asi.src.js
@@ -0,0 +1,5 @@
+class C {
+ // This is `2 * f()`
+ aaa = 2
+ *f()
+}
diff --git a/tests/fixtures/ecma-version/13/private-methods/invalid-conflict-names.result.js b/tests/fixtures/ecma-version/13/private-methods/invalid-conflict-names.result.js
new file mode 100644
index 00000000..71125475
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/invalid-conflict-names.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 25,
+ "lineNumber": 3,
+ "column": 5,
+ "message": "Identifier '#a' has already been declared"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/private-methods/invalid-conflict-names.src.js b/tests/fixtures/ecma-version/13/private-methods/invalid-conflict-names.src.js
new file mode 100644
index 00000000..720d6100
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/invalid-conflict-names.src.js
@@ -0,0 +1,4 @@
+class C {
+ #a(){}
+ #a(){}
+}
diff --git a/tests/fixtures/ecma-version/13/private-methods/invalid-constructor.result.js b/tests/fixtures/ecma-version/13/private-methods/invalid-constructor.result.js
new file mode 100644
index 00000000..c9c25ffb
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/invalid-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 14,
+ "lineNumber": 2,
+ "column": 5,
+ "message": "Classes can't have an element named '#constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/private-methods/invalid-constructor.src.js b/tests/fixtures/ecma-version/13/private-methods/invalid-constructor.src.js
new file mode 100644
index 00000000..51e1df4a
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/invalid-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ #constructor() {}
+}
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-accessor.result.js b/tests/fixtures/ecma-version/13/private-methods/valid-accessor.result.js
new file mode 100644
index 00000000..fac9f926
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-accessor.result.js
@@ -0,0 +1,558 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 48
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 48
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 48
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 14,
+ 27
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 18,
+ 22
+ ],
+ "name": "aaa"
+ },
+ "kind": "get",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 22,
+ 27
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 25,
+ 27
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 32,
+ 46
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ],
+ "name": "aaa"
+ },
+ "kind": "set",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 12
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 40,
+ 46
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 41,
+ 42
+ ],
+ "name": "x"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 44,
+ 46
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 7
+ }
+ },
+ "range": [
+ 14,
+ 17
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 8
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 18,
+ 22
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 22,
+ 23
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 13
+ },
+ "end": {
+ "line": 2,
+ "column": 14
+ }
+ },
+ "range": [
+ 23,
+ 24
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 16
+ },
+ "end": {
+ "line": 2,
+ "column": 17
+ }
+ },
+ "range": [
+ 26,
+ 27
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 32,
+ 35
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 8
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 36,
+ 40
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 12
+ },
+ "end": {
+ "line": 3,
+ "column": 13
+ }
+ },
+ "range": [
+ 40,
+ 41
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 41,
+ 42
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 14
+ },
+ "end": {
+ "line": 3,
+ "column": 15
+ }
+ },
+ "range": [
+ 42,
+ 43
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 17
+ }
+ },
+ "range": [
+ 44,
+ 45
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 17
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 47,
+ 48
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-accessor.src.js b/tests/fixtures/ecma-version/13/private-methods/valid-accessor.src.js
new file mode 100644
index 00000000..5960dc5f
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-accessor.src.js
@@ -0,0 +1,4 @@
+class C {
+ get #aaa() {}
+ set #aaa(x) {}
+}
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-async-asi.result.js b/tests/fixtures/ecma-version/13/private-methods/valid-async-asi.result.js
new file mode 100644
index 00000000..263381c7
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-async-asi.result.js
@@ -0,0 +1,615 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 136
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 136
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 136
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 85,
+ 97
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 85,
+ 92
+ ],
+ "name": "method"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 92,
+ 97
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 95,
+ 97
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 107,
+ 112
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 107,
+ 112
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 21
+ }
+ },
+ "range": [
+ 117,
+ 134
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 6
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 119,
+ 129
+ ],
+ "name": "generator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 16
+ },
+ "end": {
+ "line": 7,
+ "column": 21
+ }
+ },
+ "range": [
+ 129,
+ 134
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 19
+ },
+ "end": {
+ "line": 7,
+ "column": 21
+ }
+ },
+ "range": [
+ 132,
+ 134
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "method",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 85,
+ 92
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 92,
+ 93
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 13
+ }
+ },
+ "range": [
+ 93,
+ 94
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 95,
+ 96
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 15
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 96,
+ 97
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "range": [
+ 107,
+ 112
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "range": [
+ 117,
+ 118
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "generator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 6
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 119,
+ 129
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 16
+ },
+ "end": {
+ "line": 7,
+ "column": 17
+ }
+ },
+ "range": [
+ 129,
+ 130
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 17
+ },
+ "end": {
+ "line": 7,
+ "column": 18
+ }
+ },
+ "range": [
+ 130,
+ 131
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 19
+ },
+ "end": {
+ "line": 7,
+ "column": 20
+ }
+ },
+ "range": [
+ 132,
+ 133
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 20
+ },
+ "end": {
+ "line": 7,
+ "column": 21
+ }
+ },
+ "range": [
+ 133,
+ 134
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "range": [
+ 135,
+ 136
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-async-asi.src.js b/tests/fixtures/ecma-version/13/private-methods/valid-async-asi.src.js
new file mode 100644
index 00000000..9db6c94b
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-async-asi.src.js
@@ -0,0 +1,8 @@
+class C {
+ // Line breaks preceded by `async` create fields by ASI.
+ async
+ #method() {}
+
+ async
+ * #generator() {}
+}
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-contextual-keywords-no-asi.result.js b/tests/fixtures/ecma-version/13/private-methods/valid-contextual-keywords-no-asi.result.js
new file mode 100644
index 00000000..2e6fdcee
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-contextual-keywords-no-asi.result.js
@@ -0,0 +1,762 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 142
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 142
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 142
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 59,
+ 78
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 67,
+ 74
+ ],
+ "name": "getter"
+ },
+ "kind": "get",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 74,
+ 78
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 76,
+ 78
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 84,
+ 104
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 92,
+ 99
+ ],
+ "name": "setter"
+ },
+ "kind": "set",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 11
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 99,
+ 104
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "range": [
+ 100,
+ 101
+ ],
+ "name": "x"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 102,
+ 104
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 23
+ }
+ },
+ "range": [
+ 110,
+ 140
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 19
+ }
+ },
+ "range": [
+ 121,
+ 136
+ ],
+ "name": "asyncGenerator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 19
+ },
+ "end": {
+ "line": 10,
+ "column": 23
+ }
+ },
+ "range": [
+ 136,
+ 140
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 21
+ },
+ "end": {
+ "line": 10,
+ "column": 23
+ }
+ },
+ "range": [
+ 138,
+ 140
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 7
+ }
+ },
+ "range": [
+ 59,
+ 62
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "getter",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 67,
+ 74
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 12
+ }
+ },
+ "range": [
+ 74,
+ 75
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 13
+ }
+ },
+ "range": [
+ 75,
+ 76
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 4,
+ "column": 14
+ }
+ },
+ "range": [
+ 76,
+ 77
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 14
+ },
+ "end": {
+ "line": 4,
+ "column": 15
+ }
+ },
+ "range": [
+ 77,
+ 78
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "range": [
+ 84,
+ 87
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "setter",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 92,
+ 99
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 11
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 99,
+ 100
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "range": [
+ 100,
+ 101
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 13
+ },
+ "end": {
+ "line": 7,
+ "column": 14
+ }
+ },
+ "range": [
+ 101,
+ 102
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "range": [
+ 102,
+ 103
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 15
+ },
+ "end": {
+ "line": 7,
+ "column": 16
+ }
+ },
+ "range": [
+ 103,
+ 104
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 9
+ }
+ },
+ "range": [
+ 110,
+ 115
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 9
+ },
+ "end": {
+ "line": 9,
+ "column": 10
+ }
+ },
+ "range": [
+ 115,
+ 116
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "asyncGenerator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 19
+ }
+ },
+ "range": [
+ 121,
+ 136
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 19
+ },
+ "end": {
+ "line": 10,
+ "column": 20
+ }
+ },
+ "range": [
+ 136,
+ 137
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 20
+ },
+ "end": {
+ "line": 10,
+ "column": 21
+ }
+ },
+ "range": [
+ 137,
+ 138
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 21
+ },
+ "end": {
+ "line": 10,
+ "column": 22
+ }
+ },
+ "range": [
+ 138,
+ 139
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 22
+ },
+ "end": {
+ "line": 10,
+ "column": 23
+ }
+ },
+ "range": [
+ 139,
+ 140
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 1
+ }
+ },
+ "range": [
+ 141,
+ 142
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-contextual-keywords-no-asi.src.js b/tests/fixtures/ecma-version/13/private-methods/valid-contextual-keywords-no-asi.src.js
new file mode 100644
index 00000000..bf8227b1
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-contextual-keywords-no-asi.src.js
@@ -0,0 +1,11 @@
+class C {
+ // Line breaks don't make fields by ASI.
+ get
+ #getter(){}
+
+ set
+ #setter(x){}
+
+ async*
+ #asyncGenerator(){}
+}
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-methods.result.js b/tests/fixtures/ecma-version/13/private-methods/valid-methods.result.js
new file mode 100644
index 00000000..ae5afd90
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-methods.result.js
@@ -0,0 +1,893 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 104
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 104
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 104
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 14,
+ 26
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 14,
+ 21
+ ],
+ "name": "normal"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 21,
+ 26
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 14
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 24,
+ 26
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ },
+ "range": [
+ 31,
+ 48
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 37,
+ 43
+ ],
+ "name": "async"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ },
+ "range": [
+ 43,
+ 48
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 19
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ },
+ "range": [
+ 46,
+ 48
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 21
+ }
+ },
+ "range": [
+ 53,
+ 70
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 6
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 55,
+ 65
+ ],
+ "name": "generator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 16
+ },
+ "end": {
+ "line": 4,
+ "column": 21
+ }
+ },
+ "range": [
+ 65,
+ 70
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 19
+ },
+ "end": {
+ "line": 4,
+ "column": 21
+ }
+ },
+ "range": [
+ 68,
+ 70
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 31
+ }
+ },
+ "range": [
+ 75,
+ 102
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 11
+ },
+ "end": {
+ "line": 5,
+ "column": 26
+ }
+ },
+ "range": [
+ 82,
+ 97
+ ],
+ "name": "asyncGenerator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 26
+ },
+ "end": {
+ "line": 5,
+ "column": 31
+ }
+ },
+ "range": [
+ 97,
+ 102
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 29
+ },
+ "end": {
+ "line": 5,
+ "column": 31
+ }
+ },
+ "range": [
+ 100,
+ 102
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "normal",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 11
+ }
+ },
+ "range": [
+ 14,
+ 21
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 12
+ }
+ },
+ "range": [
+ 21,
+ 22
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 12
+ },
+ "end": {
+ "line": 2,
+ "column": 13
+ }
+ },
+ "range": [
+ 22,
+ 23
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 14
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 24,
+ 25
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 9
+ }
+ },
+ "range": [
+ 31,
+ 36
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 37,
+ 43
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 17
+ }
+ },
+ "range": [
+ 43,
+ 44
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 17
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 44,
+ 45
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 19
+ },
+ "end": {
+ "line": 3,
+ "column": 20
+ }
+ },
+ "range": [
+ 46,
+ 47
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 20
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ },
+ "range": [
+ 47,
+ 48
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 5
+ }
+ },
+ "range": [
+ 53,
+ 54
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "generator",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 6
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 55,
+ 65
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 16
+ },
+ "end": {
+ "line": 4,
+ "column": 17
+ }
+ },
+ "range": [
+ 65,
+ 66
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 17
+ },
+ "end": {
+ "line": 4,
+ "column": 18
+ }
+ },
+ "range": [
+ 66,
+ 67
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 19
+ },
+ "end": {
+ "line": 4,
+ "column": 20
+ }
+ },
+ "range": [
+ 68,
+ 69
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 20
+ },
+ "end": {
+ "line": 4,
+ "column": 21
+ }
+ },
+ "range": [
+ 69,
+ 70
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 80
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 9
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 80,
+ 81
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "asyncGenerator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 11
+ },
+ "end": {
+ "line": 5,
+ "column": 26
+ }
+ },
+ "range": [
+ 82,
+ 97
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 26
+ },
+ "end": {
+ "line": 5,
+ "column": 27
+ }
+ },
+ "range": [
+ 97,
+ 98
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 27
+ },
+ "end": {
+ "line": 5,
+ "column": 28
+ }
+ },
+ "range": [
+ 98,
+ 99
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 29
+ },
+ "end": {
+ "line": 5,
+ "column": 30
+ }
+ },
+ "range": [
+ 100,
+ 101
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 30
+ },
+ "end": {
+ "line": 5,
+ "column": 31
+ }
+ },
+ "range": [
+ 101,
+ 102
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 103,
+ 104
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/private-methods/valid-methods.src.js b/tests/fixtures/ecma-version/13/private-methods/valid-methods.src.js
new file mode 100644
index 00000000..c1a99bca
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/private-methods/valid-methods.src.js
@@ -0,0 +1,6 @@
+class C {
+ #normal() {}
+ async #async() {}
+ * #generator() {}
+ async* #asyncGenerator() {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-conflict-names.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-conflict-names.result.js
new file mode 100644
index 00000000..17688abc
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-conflict-names.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 210,
+ "lineNumber": 5,
+ "column": 16,
+ "message": "Identifier '#a' has already been declared"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-conflict-names.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-conflict-names.src.js
new file mode 100644
index 00000000..d5a9090b
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-conflict-names.src.js
@@ -0,0 +1,6 @@
+class C {
+ // getter/setter pair conflicts if `static` attributes are different.
+ // (static members and instance members are on the same namespace about naming conflicts.)
+ get #a() {}
+ static set #a(x) {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-field-constructor.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-field-constructor.result.js
new file mode 100644
index 00000000..5320beb0
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-field-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 21,
+ "lineNumber": 2,
+ "column": 12,
+ "message": "Classes can't have an element named '#constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-field-constructor.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-field-constructor.src.js
new file mode 100644
index 00000000..77132340
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-field-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ static #constructor = () => {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-getter-constructor.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-getter-constructor.result.js
new file mode 100644
index 00000000..fcb083c2
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-getter-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 25,
+ "lineNumber": 2,
+ "column": 16,
+ "message": "Classes can't have an element named '#constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-getter-constructor.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-getter-constructor.src.js
new file mode 100644
index 00000000..7e89b4da
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-getter-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ static get #constructor() {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-method-constructor.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-method-constructor.result.js
new file mode 100644
index 00000000..5320beb0
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-method-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 21,
+ "lineNumber": 2,
+ "column": 12,
+ "message": "Classes can't have an element named '#constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-method-constructor.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-method-constructor.src.js
new file mode 100644
index 00000000..59124f3e
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-method-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ static #constructor() {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-setter-constructor.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-setter-constructor.result.js
new file mode 100644
index 00000000..fcb083c2
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-setter-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 25,
+ "lineNumber": 2,
+ "column": 16,
+ "message": "Classes can't have an element named '#constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-private-setter-constructor.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-setter-constructor.src.js
new file mode 100644
index 00000000..25d7a530
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-private-setter-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ static set #constructor(x) {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-constructor.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-constructor.result.js
new file mode 100644
index 00000000..6f1ac47e
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-constructor.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 21,
+ "lineNumber": 2,
+ "column": 12,
+ "message": "Classes can't have a field named 'constructor'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-constructor.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-constructor.src.js
new file mode 100644
index 00000000..cbd8d3c9
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-constructor.src.js
@@ -0,0 +1,3 @@
+class C {
+ static constructor = () => {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-prototype.result.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-prototype.result.js
new file mode 100644
index 00000000..831bed4c
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-prototype.result.js
@@ -0,0 +1,6 @@
+export default {
+ "index": 21,
+ "lineNumber": 2,
+ "column": 12,
+ "message": "Classes can't have a static field named 'prototype'"
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-prototype.src.js b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-prototype.src.js
new file mode 100644
index 00000000..53bbb5df
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/invalid-public-field-prototype.src.js
@@ -0,0 +1,3 @@
+class C {
+ static prototype = {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-async-asi.result.js b/tests/fixtures/ecma-version/13/static-class-features/valid-async-asi.result.js
new file mode 100644
index 00000000..843841d4
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-async-asi.result.js
@@ -0,0 +1,1153 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 18,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 247
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 18,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 247
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 18,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 247
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 75,
+ 91
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 86,
+ 91
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 96,
+ 108
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "range": [
+ 96,
+ 103
+ ],
+ "name": "method"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 11
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 103,
+ 108
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 14
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 106,
+ 108
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 118,
+ 134
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 129,
+ 134
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 21
+ }
+ },
+ "range": [
+ 139,
+ 156
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 6
+ },
+ "end": {
+ "line": 9,
+ "column": 16
+ }
+ },
+ "range": [
+ 141,
+ 151
+ ],
+ "name": "generator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 16
+ },
+ "end": {
+ "line": 9,
+ "column": 21
+ }
+ },
+ "range": [
+ 151,
+ 156
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 19
+ },
+ "end": {
+ "line": 9,
+ "column": 21
+ }
+ },
+ "range": [
+ 154,
+ 156
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 9
+ }
+ },
+ "range": [
+ 166,
+ 182
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 9
+ }
+ },
+ "range": [
+ 177,
+ 182
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 4
+ },
+ "end": {
+ "line": 13,
+ "column": 15
+ }
+ },
+ "range": [
+ 187,
+ 198
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 4
+ },
+ "end": {
+ "line": 13,
+ "column": 10
+ }
+ },
+ "range": [
+ 187,
+ 193
+ ],
+ "name": "method"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 10
+ },
+ "end": {
+ "line": 13,
+ "column": 15
+ }
+ },
+ "range": [
+ 193,
+ 198
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 13
+ },
+ "end": {
+ "line": 13,
+ "column": 15
+ }
+ },
+ "range": [
+ 196,
+ 198
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 4
+ },
+ "end": {
+ "line": 16,
+ "column": 9
+ }
+ },
+ "range": [
+ 208,
+ 224
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 16,
+ "column": 4
+ },
+ "end": {
+ "line": 16,
+ "column": 9
+ }
+ },
+ "range": [
+ 219,
+ 224
+ ],
+ "name": "async"
+ },
+ "value": null
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 4
+ },
+ "end": {
+ "line": 17,
+ "column": 20
+ }
+ },
+ "range": [
+ 229,
+ 245
+ ],
+ "static": false,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 6
+ },
+ "end": {
+ "line": 17,
+ "column": 15
+ }
+ },
+ "range": [
+ 231,
+ 240
+ ],
+ "name": "generator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 15
+ },
+ "end": {
+ "line": 17,
+ "column": 20
+ }
+ },
+ "range": [
+ 240,
+ 245
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 18
+ },
+ "end": {
+ "line": 17,
+ "column": 20
+ }
+ },
+ "range": [
+ 243,
+ 245
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 75,
+ 81
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 86,
+ 91
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "method",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "range": [
+ 96,
+ 103
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 11
+ },
+ "end": {
+ "line": 5,
+ "column": 12
+ }
+ },
+ "range": [
+ 103,
+ 104
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 12
+ },
+ "end": {
+ "line": 5,
+ "column": 13
+ }
+ },
+ "range": [
+ 104,
+ 105
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 14
+ },
+ "end": {
+ "line": 5,
+ "column": 15
+ }
+ },
+ "range": [
+ 106,
+ 107
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 15
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 107,
+ 108
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 118,
+ 124
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "range": [
+ 129,
+ 134
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "range": [
+ 139,
+ 140
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "generator",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 6
+ },
+ "end": {
+ "line": 9,
+ "column": 16
+ }
+ },
+ "range": [
+ 141,
+ 151
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 16
+ },
+ "end": {
+ "line": 9,
+ "column": 17
+ }
+ },
+ "range": [
+ 151,
+ 152
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 17
+ },
+ "end": {
+ "line": 9,
+ "column": 18
+ }
+ },
+ "range": [
+ 152,
+ 153
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 19
+ },
+ "end": {
+ "line": 9,
+ "column": 20
+ }
+ },
+ "range": [
+ 154,
+ 155
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 20
+ },
+ "end": {
+ "line": 9,
+ "column": 21
+ }
+ },
+ "range": [
+ 155,
+ 156
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 10
+ }
+ },
+ "range": [
+ 166,
+ 172
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 9
+ }
+ },
+ "range": [
+ 177,
+ 182
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "method",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 4
+ },
+ "end": {
+ "line": 13,
+ "column": 10
+ }
+ },
+ "range": [
+ 187,
+ 193
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 10
+ },
+ "end": {
+ "line": 13,
+ "column": 11
+ }
+ },
+ "range": [
+ 193,
+ 194
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 11
+ },
+ "end": {
+ "line": 13,
+ "column": 12
+ }
+ },
+ "range": [
+ 194,
+ 195
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 13
+ },
+ "end": {
+ "line": 13,
+ "column": 14
+ }
+ },
+ "range": [
+ 196,
+ 197
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 14
+ },
+ "end": {
+ "line": 13,
+ "column": 15
+ }
+ },
+ "range": [
+ 197,
+ 198
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 4
+ },
+ "end": {
+ "line": 15,
+ "column": 10
+ }
+ },
+ "range": [
+ 208,
+ 214
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 16,
+ "column": 4
+ },
+ "end": {
+ "line": 16,
+ "column": 9
+ }
+ },
+ "range": [
+ 219,
+ 224
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 4
+ },
+ "end": {
+ "line": 17,
+ "column": 5
+ }
+ },
+ "range": [
+ 229,
+ 230
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "generator",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 6
+ },
+ "end": {
+ "line": 17,
+ "column": 15
+ }
+ },
+ "range": [
+ 231,
+ 240
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 15
+ },
+ "end": {
+ "line": 17,
+ "column": 16
+ }
+ },
+ "range": [
+ 240,
+ 241
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 16
+ },
+ "end": {
+ "line": 17,
+ "column": 17
+ }
+ },
+ "range": [
+ 241,
+ 242
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 18
+ },
+ "end": {
+ "line": 17,
+ "column": 19
+ }
+ },
+ "range": [
+ 243,
+ 244
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 19
+ },
+ "end": {
+ "line": 17,
+ "column": 20
+ }
+ },
+ "range": [
+ 244,
+ 245
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 0
+ },
+ "end": {
+ "line": 18,
+ "column": 1
+ }
+ },
+ "range": [
+ 246,
+ 247
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-async-asi.src.js b/tests/fixtures/ecma-version/13/static-class-features/valid-async-asi.src.js
new file mode 100644
index 00000000..b1f91eed
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-async-asi.src.js
@@ -0,0 +1,18 @@
+class C {
+ // Line breaks preceded by `async` create fields by ASI.
+ static
+ async
+ #method() {}
+
+ static
+ async
+ * #generator() {}
+
+ static
+ async
+ method() {}
+
+ static
+ async
+ * generator() {}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-contextual-keywords-no-asi.result.js b/tests/fixtures/ecma-version/13/static-class-features/valid-contextual-keywords-no-asi.result.js
new file mode 100644
index 00000000..874bf3d2
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-contextual-keywords-no-asi.result.js
@@ -0,0 +1,1819 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 30,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 351
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 30,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 351
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 30,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 351
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 59,
+ 77
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 70,
+ 73
+ ],
+ "name": "get"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 7
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 73,
+ 77
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 75,
+ 77
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 83,
+ 102
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 7
+ }
+ },
+ "range": [
+ 94,
+ 97
+ ],
+ "name": "set"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 7
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 97,
+ 102
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "range": [
+ 98,
+ 99
+ ],
+ "name": "x"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 10
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 100,
+ 102
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 13
+ }
+ },
+ "range": [
+ 108,
+ 128
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 9
+ }
+ },
+ "range": [
+ 119,
+ 124
+ ],
+ "name": "async"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 9
+ },
+ "end": {
+ "line": 10,
+ "column": 13
+ }
+ },
+ "range": [
+ 124,
+ 128
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 13
+ }
+ },
+ "range": [
+ 126,
+ 128
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "range": [
+ 134,
+ 169
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 4
+ },
+ "end": {
+ "line": 14,
+ "column": 16
+ }
+ },
+ "range": [
+ 153,
+ 165
+ ],
+ "name": "staticGetter"
+ },
+ "kind": "get",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 16
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "range": [
+ 165,
+ 169
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 18
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "range": [
+ 167,
+ 169
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 16,
+ "column": 4
+ },
+ "end": {
+ "line": 18,
+ "column": 21
+ }
+ },
+ "range": [
+ 175,
+ 211
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 4
+ },
+ "end": {
+ "line": 18,
+ "column": 16
+ }
+ },
+ "range": [
+ 194,
+ 206
+ ],
+ "name": "staticGetter"
+ },
+ "kind": "set",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 16
+ },
+ "end": {
+ "line": 18,
+ "column": 21
+ }
+ },
+ "range": [
+ 206,
+ 211
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 17
+ },
+ "end": {
+ "line": 18,
+ "column": 18
+ }
+ },
+ "range": [
+ 207,
+ 208
+ ],
+ "name": "x"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 19
+ },
+ "end": {
+ "line": 18,
+ "column": 21
+ }
+ },
+ "range": [
+ 209,
+ 211
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 20,
+ "column": 4
+ },
+ "end": {
+ "line": 22,
+ "column": 23
+ }
+ },
+ "range": [
+ 217,
+ 253
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 4
+ },
+ "end": {
+ "line": 22,
+ "column": 19
+ }
+ },
+ "range": [
+ 234,
+ 249
+ ],
+ "name": "staticGenerator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 19
+ },
+ "end": {
+ "line": 22,
+ "column": 23
+ }
+ },
+ "range": [
+ 249,
+ 253
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 21
+ },
+ "end": {
+ "line": 22,
+ "column": 23
+ }
+ },
+ "range": [
+ 251,
+ 253
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 24,
+ "column": 4
+ },
+ "end": {
+ "line": 25,
+ "column": 31
+ }
+ },
+ "range": [
+ 259,
+ 297
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 10
+ },
+ "end": {
+ "line": 25,
+ "column": 27
+ }
+ },
+ "range": [
+ 276,
+ 293
+ ],
+ "name": "staticAsyncMethod"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 27
+ },
+ "end": {
+ "line": 25,
+ "column": 31
+ }
+ },
+ "range": [
+ 293,
+ 297
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 29
+ },
+ "end": {
+ "line": 25,
+ "column": 31
+ }
+ },
+ "range": [
+ 295,
+ 297
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 27,
+ "column": 4
+ },
+ "end": {
+ "line": 29,
+ "column": 28
+ }
+ },
+ "range": [
+ 303,
+ 349
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 4
+ },
+ "end": {
+ "line": 29,
+ "column": 24
+ }
+ },
+ "range": [
+ 325,
+ 345
+ ],
+ "name": "staticAsyncGenerator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 24
+ },
+ "end": {
+ "line": 29,
+ "column": 28
+ }
+ },
+ "range": [
+ 345,
+ 349
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 26
+ },
+ "end": {
+ "line": 29,
+ "column": 28
+ }
+ },
+ "range": [
+ 347,
+ 349
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 59,
+ 65
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 7
+ }
+ },
+ "range": [
+ 70,
+ 73
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 7
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ },
+ "range": [
+ 73,
+ 74
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ },
+ "range": [
+ 74,
+ 75
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 75,
+ 76
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 10
+ },
+ "end": {
+ "line": 4,
+ "column": 11
+ }
+ },
+ "range": [
+ 76,
+ 77
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 10
+ }
+ },
+ "range": [
+ 83,
+ 89
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 7
+ }
+ },
+ "range": [
+ 94,
+ 97
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 7
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "range": [
+ 97,
+ 98
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "range": [
+ 98,
+ 99
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 9
+ },
+ "end": {
+ "line": 7,
+ "column": 10
+ }
+ },
+ "range": [
+ 99,
+ 100
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 10
+ },
+ "end": {
+ "line": 7,
+ "column": 11
+ }
+ },
+ "range": [
+ 100,
+ 101
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 11
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "range": [
+ 101,
+ 102
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 10
+ }
+ },
+ "range": [
+ 108,
+ 114
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 9
+ }
+ },
+ "range": [
+ 119,
+ 124
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 9
+ },
+ "end": {
+ "line": 10,
+ "column": 10
+ }
+ },
+ "range": [
+ 124,
+ 125
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 10
+ },
+ "end": {
+ "line": 10,
+ "column": 11
+ }
+ },
+ "range": [
+ 125,
+ 126
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "range": [
+ 126,
+ 127
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 12
+ },
+ "end": {
+ "line": 10,
+ "column": 13
+ }
+ },
+ "range": [
+ 127,
+ 128
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 10
+ }
+ },
+ "range": [
+ 134,
+ 140
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 4
+ },
+ "end": {
+ "line": 13,
+ "column": 7
+ }
+ },
+ "range": [
+ 145,
+ 148
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "staticGetter",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 4
+ },
+ "end": {
+ "line": 14,
+ "column": 16
+ }
+ },
+ "range": [
+ 153,
+ 165
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 16
+ },
+ "end": {
+ "line": 14,
+ "column": 17
+ }
+ },
+ "range": [
+ 165,
+ 166
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 17
+ },
+ "end": {
+ "line": 14,
+ "column": 18
+ }
+ },
+ "range": [
+ 166,
+ 167
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 18
+ },
+ "end": {
+ "line": 14,
+ "column": 19
+ }
+ },
+ "range": [
+ 167,
+ 168
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 19
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "range": [
+ 168,
+ 169
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 16,
+ "column": 4
+ },
+ "end": {
+ "line": 16,
+ "column": 10
+ }
+ },
+ "range": [
+ 175,
+ 181
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 17,
+ "column": 4
+ },
+ "end": {
+ "line": 17,
+ "column": 7
+ }
+ },
+ "range": [
+ 186,
+ 189
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "staticGetter",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 4
+ },
+ "end": {
+ "line": 18,
+ "column": 16
+ }
+ },
+ "range": [
+ 194,
+ 206
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 16
+ },
+ "end": {
+ "line": 18,
+ "column": 17
+ }
+ },
+ "range": [
+ 206,
+ 207
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 17
+ },
+ "end": {
+ "line": 18,
+ "column": 18
+ }
+ },
+ "range": [
+ 207,
+ 208
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 18
+ },
+ "end": {
+ "line": 18,
+ "column": 19
+ }
+ },
+ "range": [
+ 208,
+ 209
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 19
+ },
+ "end": {
+ "line": 18,
+ "column": 20
+ }
+ },
+ "range": [
+ 209,
+ 210
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 18,
+ "column": 20
+ },
+ "end": {
+ "line": 18,
+ "column": 21
+ }
+ },
+ "range": [
+ 210,
+ 211
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 20,
+ "column": 4
+ },
+ "end": {
+ "line": 20,
+ "column": 10
+ }
+ },
+ "range": [
+ 217,
+ 223
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 21,
+ "column": 4
+ },
+ "end": {
+ "line": 21,
+ "column": 5
+ }
+ },
+ "range": [
+ 228,
+ 229
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "staticGenerator",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 4
+ },
+ "end": {
+ "line": 22,
+ "column": 19
+ }
+ },
+ "range": [
+ 234,
+ 249
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 19
+ },
+ "end": {
+ "line": 22,
+ "column": 20
+ }
+ },
+ "range": [
+ 249,
+ 250
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 20
+ },
+ "end": {
+ "line": 22,
+ "column": 21
+ }
+ },
+ "range": [
+ 250,
+ 251
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 21
+ },
+ "end": {
+ "line": 22,
+ "column": 22
+ }
+ },
+ "range": [
+ 251,
+ 252
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 22,
+ "column": 22
+ },
+ "end": {
+ "line": 22,
+ "column": 23
+ }
+ },
+ "range": [
+ 252,
+ 253
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 24,
+ "column": 4
+ },
+ "end": {
+ "line": 24,
+ "column": 10
+ }
+ },
+ "range": [
+ 259,
+ 265
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 4
+ },
+ "end": {
+ "line": 25,
+ "column": 9
+ }
+ },
+ "range": [
+ 270,
+ 275
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "staticAsyncMethod",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 10
+ },
+ "end": {
+ "line": 25,
+ "column": 27
+ }
+ },
+ "range": [
+ 276,
+ 293
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 27
+ },
+ "end": {
+ "line": 25,
+ "column": 28
+ }
+ },
+ "range": [
+ 293,
+ 294
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 28
+ },
+ "end": {
+ "line": 25,
+ "column": 29
+ }
+ },
+ "range": [
+ 294,
+ 295
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 29
+ },
+ "end": {
+ "line": 25,
+ "column": 30
+ }
+ },
+ "range": [
+ 295,
+ 296
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 25,
+ "column": 30
+ },
+ "end": {
+ "line": 25,
+ "column": 31
+ }
+ },
+ "range": [
+ 296,
+ 297
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 27,
+ "column": 4
+ },
+ "end": {
+ "line": 27,
+ "column": 10
+ }
+ },
+ "range": [
+ 303,
+ 309
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 28,
+ "column": 4
+ },
+ "end": {
+ "line": 28,
+ "column": 9
+ }
+ },
+ "range": [
+ 314,
+ 319
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 28,
+ "column": 9
+ },
+ "end": {
+ "line": 28,
+ "column": 10
+ }
+ },
+ "range": [
+ 319,
+ 320
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "staticAsyncGenerator",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 4
+ },
+ "end": {
+ "line": 29,
+ "column": 24
+ }
+ },
+ "range": [
+ 325,
+ 345
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 24
+ },
+ "end": {
+ "line": 29,
+ "column": 25
+ }
+ },
+ "range": [
+ 345,
+ 346
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 25
+ },
+ "end": {
+ "line": 29,
+ "column": 26
+ }
+ },
+ "range": [
+ 346,
+ 347
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 26
+ },
+ "end": {
+ "line": 29,
+ "column": 27
+ }
+ },
+ "range": [
+ 347,
+ 348
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 29,
+ "column": 27
+ },
+ "end": {
+ "line": 29,
+ "column": 28
+ }
+ },
+ "range": [
+ 348,
+ 349
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 30,
+ "column": 0
+ },
+ "end": {
+ "line": 30,
+ "column": 1
+ }
+ },
+ "range": [
+ 350,
+ 351
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-contextual-keywords-no-asi.src.js b/tests/fixtures/ecma-version/13/static-class-features/valid-contextual-keywords-no-asi.src.js
new file mode 100644
index 00000000..0e70bbf5
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-contextual-keywords-no-asi.src.js
@@ -0,0 +1,30 @@
+class C {
+ // Line breaks don't make fields by ASI.
+ static
+ get(){}
+
+ static
+ set(x){}
+
+ static
+ async(){}
+
+ static
+ get
+ staticGetter(){}
+
+ static
+ set
+ staticGetter(x){}
+
+ static
+ *
+ staticGenerator(){}
+
+ static
+ async staticAsyncMethod(){}
+
+ static
+ async*
+ staticAsyncGenerator(){}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-private-accessors.result.js b/tests/fixtures/ecma-version/13/static-class-features/valid-private-accessors.result.js
new file mode 100644
index 00000000..2d01ed55
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-private-accessors.result.js
@@ -0,0 +1,630 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 62
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 62
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 62
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 23
+ }
+ },
+ "range": [
+ 14,
+ 33
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 19
+ }
+ },
+ "range": [
+ 25,
+ 29
+ ],
+ "name": "aaa"
+ },
+ "kind": "get",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 19
+ },
+ "end": {
+ "line": 2,
+ "column": 23
+ }
+ },
+ "range": [
+ 29,
+ 33
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 23
+ }
+ },
+ "range": [
+ 31,
+ 33
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 39,
+ 59
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ },
+ "range": [
+ 50,
+ 54
+ ],
+ "name": "aaa"
+ },
+ "kind": "set",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 19
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 54,
+ 59
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [
+ {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 20
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ },
+ "range": [
+ 55,
+ 56
+ ],
+ "name": "x"
+ }
+ ],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 22
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 57,
+ 59
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "range": [
+ 14,
+ 20
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "get",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 14
+ }
+ },
+ "range": [
+ 21,
+ 24
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 19
+ }
+ },
+ "range": [
+ 25,
+ 29
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 19
+ },
+ "end": {
+ "line": 2,
+ "column": 20
+ }
+ },
+ "range": [
+ 29,
+ 30
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 20
+ },
+ "end": {
+ "line": 2,
+ "column": 21
+ }
+ },
+ "range": [
+ 30,
+ 31
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ },
+ "range": [
+ 31,
+ 32
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 22
+ },
+ "end": {
+ "line": 2,
+ "column": 23
+ }
+ },
+ "range": [
+ 32,
+ 33
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 23
+ },
+ "end": {
+ "line": 2,
+ "column": 24
+ }
+ },
+ "range": [
+ 33,
+ 34
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 39,
+ 45
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "set",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 46,
+ 49
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ },
+ "range": [
+ 50,
+ 54
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 19
+ },
+ "end": {
+ "line": 3,
+ "column": 20
+ }
+ },
+ "range": [
+ 54,
+ 55
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "x",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 20
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ },
+ "range": [
+ 55,
+ 56
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 21
+ },
+ "end": {
+ "line": 3,
+ "column": 22
+ }
+ },
+ "range": [
+ 56,
+ 57
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 22
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ },
+ "range": [
+ 57,
+ 58
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 58,
+ 59
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 24
+ },
+ "end": {
+ "line": 3,
+ "column": 25
+ }
+ },
+ "range": [
+ 59,
+ 60
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 61,
+ 62
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-private-accessors.src.js b/tests/fixtures/ecma-version/13/static-class-features/valid-private-accessors.src.js
new file mode 100644
index 00000000..917efe58
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-private-accessors.src.js
@@ -0,0 +1,4 @@
+class C {
+ static get #aaa(){};
+ static set #aaa(x){};
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-private-fields.result.js b/tests/fixtures/ecma-version/13/static-class-features/valid-private-fields.result.js
new file mode 100644
index 00000000..1f747b02
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-private-fields.result.js
@@ -0,0 +1,387 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 49
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 49
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 49
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 14,
+ 26
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 21,
+ 25
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 20
+ }
+ },
+ "range": [
+ 31,
+ 47
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 15
+ }
+ },
+ "range": [
+ 38,
+ 42
+ ],
+ "name": "bbb"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 18
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "range": [
+ 14,
+ 20
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 21,
+ 25
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 15
+ },
+ "end": {
+ "line": 2,
+ "column": 16
+ }
+ },
+ "range": [
+ 25,
+ 26
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 31,
+ 37
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "bbb",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 15
+ }
+ },
+ "range": [
+ 38,
+ 42
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 16
+ },
+ "end": {
+ "line": 3,
+ "column": 17
+ }
+ },
+ "range": [
+ 43,
+ 44
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 18
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ },
+ "range": [
+ 45,
+ 46
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 19
+ },
+ "end": {
+ "line": 3,
+ "column": 20
+ }
+ },
+ "range": [
+ 46,
+ 47
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 48,
+ 49
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-private-fields.src.js b/tests/fixtures/ecma-version/13/static-class-features/valid-private-fields.src.js
new file mode 100644
index 00000000..07be5668
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-private-fields.src.js
@@ -0,0 +1,4 @@
+class C {
+ static #aaa;
+ static #bbb = 0;
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-private-methods.result.js b/tests/fixtures/ecma-version/13/static-class-features/valid-private-methods.result.js
new file mode 100644
index 00000000..8064b579
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-private-methods.result.js
@@ -0,0 +1,965 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 128
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 128
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 128
+ ],
+ "body": [
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ },
+ "range": [
+ 14,
+ 32
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 18
+ }
+ },
+ "range": [
+ 21,
+ 28
+ ],
+ "name": "method"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 18
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ },
+ "range": [
+ 28,
+ 32
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 20
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ },
+ "range": [
+ 30,
+ 32
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 27
+ }
+ },
+ "range": [
+ 37,
+ 60
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ },
+ "range": [
+ 46,
+ 56
+ ],
+ "name": "generator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 27
+ }
+ },
+ "range": [
+ 56,
+ 60
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": false,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 25
+ },
+ "end": {
+ "line": 3,
+ "column": 27
+ }
+ },
+ "range": [
+ 58,
+ 60
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 27
+ }
+ },
+ "range": [
+ 65,
+ 88
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 17
+ },
+ "end": {
+ "line": 4,
+ "column": 23
+ }
+ },
+ "range": [
+ 78,
+ 84
+ ],
+ "name": "async"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 23
+ },
+ "end": {
+ "line": 4,
+ "column": 27
+ }
+ },
+ "range": [
+ 84,
+ 88
+ ],
+ "id": null,
+ "expression": false,
+ "generator": false,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 25
+ },
+ "end": {
+ "line": 4,
+ "column": 27
+ }
+ },
+ "range": [
+ 86,
+ 88
+ ],
+ "body": []
+ }
+ }
+ },
+ {
+ "type": "MethodDefinition",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ },
+ "range": [
+ 93,
+ 126
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "PrivateIdentifier",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 18
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ },
+ "range": [
+ 107,
+ 122
+ ],
+ "name": "asyncGenerator"
+ },
+ "kind": "method",
+ "value": {
+ "type": "FunctionExpression",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 33
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ },
+ "range": [
+ 122,
+ 126
+ ],
+ "id": null,
+ "expression": false,
+ "generator": true,
+ "async": true,
+ "params": [],
+ "body": {
+ "type": "BlockStatement",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 35
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ },
+ "range": [
+ 124,
+ 126
+ ],
+ "body": []
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "range": [
+ 14,
+ 20
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "method",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 18
+ }
+ },
+ "range": [
+ 21,
+ 28
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 18
+ },
+ "end": {
+ "line": 2,
+ "column": 19
+ }
+ },
+ "range": [
+ 28,
+ 29
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 19
+ },
+ "end": {
+ "line": 2,
+ "column": 20
+ }
+ },
+ "range": [
+ 29,
+ 30
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 20
+ },
+ "end": {
+ "line": 2,
+ "column": 21
+ }
+ },
+ "range": [
+ 30,
+ 31
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 21
+ },
+ "end": {
+ "line": 2,
+ "column": 22
+ }
+ },
+ "range": [
+ 31,
+ 32
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 37,
+ 43
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "range": [
+ 44,
+ 45
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "generator",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ },
+ "range": [
+ 46,
+ 56
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ },
+ "range": [
+ 56,
+ 57
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 24
+ },
+ "end": {
+ "line": 3,
+ "column": 25
+ }
+ },
+ "range": [
+ 57,
+ 58
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 25
+ },
+ "end": {
+ "line": 3,
+ "column": 26
+ }
+ },
+ "range": [
+ 58,
+ 59
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 26
+ },
+ "end": {
+ "line": 3,
+ "column": 27
+ }
+ },
+ "range": [
+ 59,
+ 60
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 10
+ }
+ },
+ "range": [
+ 65,
+ 71
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 11
+ },
+ "end": {
+ "line": 4,
+ "column": 16
+ }
+ },
+ "range": [
+ 72,
+ 77
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 17
+ },
+ "end": {
+ "line": 4,
+ "column": 23
+ }
+ },
+ "range": [
+ 78,
+ 84
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 23
+ },
+ "end": {
+ "line": 4,
+ "column": 24
+ }
+ },
+ "range": [
+ 84,
+ 85
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 24
+ },
+ "end": {
+ "line": 4,
+ "column": 25
+ }
+ },
+ "range": [
+ 85,
+ 86
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 25
+ },
+ "end": {
+ "line": 4,
+ "column": 26
+ }
+ },
+ "range": [
+ 86,
+ 87
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 26
+ },
+ "end": {
+ "line": 4,
+ "column": 27
+ }
+ },
+ "range": [
+ 87,
+ 88
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "range": [
+ 93,
+ 99
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "async",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 11
+ },
+ "end": {
+ "line": 5,
+ "column": 16
+ }
+ },
+ "range": [
+ 100,
+ 105
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "*",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 16
+ },
+ "end": {
+ "line": 5,
+ "column": 17
+ }
+ },
+ "range": [
+ 105,
+ 106
+ ]
+ },
+ {
+ "type": "PrivateIdentifier",
+ "value": "asyncGenerator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 18
+ },
+ "end": {
+ "line": 5,
+ "column": 33
+ }
+ },
+ "range": [
+ 107,
+ 122
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 33
+ },
+ "end": {
+ "line": 5,
+ "column": 34
+ }
+ },
+ "range": [
+ 122,
+ 123
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 34
+ },
+ "end": {
+ "line": 5,
+ "column": 35
+ }
+ },
+ "range": [
+ 123,
+ 124
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 35
+ },
+ "end": {
+ "line": 5,
+ "column": 36
+ }
+ },
+ "range": [
+ 124,
+ 125
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 36
+ },
+ "end": {
+ "line": 5,
+ "column": 37
+ }
+ },
+ "range": [
+ 125,
+ 126
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ },
+ "range": [
+ 127,
+ 128
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-private-methods.src.js b/tests/fixtures/ecma-version/13/static-class-features/valid-private-methods.src.js
new file mode 100644
index 00000000..8cfe5f40
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-private-methods.src.js
@@ -0,0 +1,6 @@
+class C {
+ static #method(){}
+ static * #generator(){}
+ static async #async(){}
+ static async* #asyncGenerator(){}
+}
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-public-fields.result.js b/tests/fixtures/ecma-version/13/static-class-features/valid-public-fields.result.js
new file mode 100644
index 00000000..9aebd4ce
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-public-fields.result.js
@@ -0,0 +1,387 @@
+export default {
+ "type": "Program",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 47
+ ],
+ "body": [
+ {
+ "type": "ClassDeclaration",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 0,
+ 47
+ ],
+ "id": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ],
+ "name": "C"
+ },
+ "superClass": null,
+ "body": {
+ "type": "ClassBody",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 8,
+ 47
+ ],
+ "body": [
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 14,
+ 25
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 14
+ }
+ },
+ "range": [
+ 21,
+ 24
+ ],
+ "name": "aaa"
+ },
+ "value": null
+ },
+ {
+ "type": "PropertyDefinition",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ },
+ "range": [
+ 30,
+ 45
+ ],
+ "static": true,
+ "computed": false,
+ "key": {
+ "type": "Identifier",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 37,
+ 40
+ ],
+ "name": "bbb"
+ },
+ "value": {
+ "type": "Literal",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 17
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 43,
+ 44
+ ],
+ "value": 0,
+ "raw": "0"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "sourceType": "script",
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "class",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 5
+ }
+ },
+ "range": [
+ 0,
+ 5
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "C",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 6
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ },
+ "range": [
+ 6,
+ 7
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "range": [
+ 8,
+ 9
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "range": [
+ 14,
+ 20
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "aaa",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 11
+ },
+ "end": {
+ "line": 2,
+ "column": 14
+ }
+ },
+ "range": [
+ 21,
+ 24
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 14
+ },
+ "end": {
+ "line": 2,
+ "column": 15
+ }
+ },
+ "range": [
+ 24,
+ 25
+ ]
+ },
+ {
+ "type": "Keyword",
+ "value": "static",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 10
+ }
+ },
+ "range": [
+ 30,
+ 36
+ ]
+ },
+ {
+ "type": "Identifier",
+ "value": "bbb",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 11
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ },
+ "range": [
+ 37,
+ 40
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 16
+ }
+ },
+ "range": [
+ 41,
+ 42
+ ]
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 17
+ },
+ "end": {
+ "line": 3,
+ "column": 18
+ }
+ },
+ "range": [
+ 43,
+ 44
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 18
+ },
+ "end": {
+ "line": 3,
+ "column": 19
+ }
+ },
+ "range": [
+ 44,
+ 45
+ ]
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ },
+ "range": [
+ 46,
+ 47
+ ]
+ }
+ ]
+};
\ No newline at end of file
diff --git a/tests/fixtures/ecma-version/13/static-class-features/valid-public-fields.src.js b/tests/fixtures/ecma-version/13/static-class-features/valid-public-fields.src.js
new file mode 100644
index 00000000..fd1cf0e1
--- /dev/null
+++ b/tests/fixtures/ecma-version/13/static-class-features/valid-public-fields.src.js
@@ -0,0 +1,4 @@
+class C {
+ static aaa;
+ static bbb = 0;
+}
diff --git a/tests/lib/supported-ecmaversions.js b/tests/lib/supported-ecmaversions.js
index 8f66cf15..328e208b 100644
--- a/tests/lib/supported-ecmaversions.js
+++ b/tests/lib/supported-ecmaversions.js
@@ -17,7 +17,7 @@ import * as espree from "../../espree.js";
describe("latestEcmaVersion", () => {
it("should return the latest supported ecmaVersion", () => {
- assert.strictEqual(espree.latestEcmaVersion, 12);
+ assert.strictEqual(espree.latestEcmaVersion, 13);
});
});
@@ -25,7 +25,7 @@ describe("supportedEcmaVersions", () => {
it("should return an array of all supported versions", () => {
assert.deepStrictEqual(
espree.supportedEcmaVersions,
- [3, 5, 6, 7, 8, 9, 10, 11, 12]
+ [3, 5, 6, 7, 8, 9, 10, 11, 12, 13]
);
});
});
diff --git a/tests/lib/tester-test.js b/tests/lib/tester-test.js
new file mode 100644
index 00000000..420c3ed8
--- /dev/null
+++ b/tests/lib/tester-test.js
@@ -0,0 +1,139 @@
+import assert from "assert";
+import tester from "./tester.js";
+
+const { getRaw, getAstCode } = tester;
+
+describe("Tester", () => {
+ describe("getRaw", () => {
+ it("should remove `start` and `end` properties", () => {
+ assert.deepStrictEqual(
+ getRaw({ start: 0, end: 1, node: { start: 2, end: 3, value: 4 } }),
+ { node: { value: 4 } }
+ );
+ });
+
+ it("should keep NaN", () => {
+ assert.deepStrictEqual(
+ getRaw({ value: NaN }),
+ { value: NaN }
+ );
+ });
+
+ it("should keep Infinity", () => {
+ assert.deepStrictEqual(
+ getRaw({ value: Infinity }),
+ { value: Infinity }
+ );
+ });
+
+ it("should keep -Infinity", () => {
+ assert.deepStrictEqual(
+ getRaw({ value: -Infinity }),
+ { value: -Infinity }
+ );
+ });
+
+ it("should keep bigint values", () => {
+ assert.deepStrictEqual(
+ getRaw({ value: BigInt("123") }),
+ { value: BigInt("123") }
+ );
+ });
+
+ it("should keep RegExp objects", () => {
+ assert.deepStrictEqual(
+ // eslint-disable-next-line require-unicode-regexp
+ getRaw({ value: /foo/ }),
+ // eslint-disable-next-line require-unicode-regexp
+ { value: /foo/ }
+ );
+ assert.deepStrictEqual(
+ getRaw({ value: /foo/u }),
+ { value: /foo/u }
+ );
+
+ // check about escape sequences of `JSON.stringify`.
+ assert.deepStrictEqual(
+ getRaw({ value: /"foo"/u }),
+ { value: /"foo"/u }
+ );
+ assert.deepStrictEqual(
+ getRaw({ value: /\d\/\d/u }),
+ { value: /\d\/\d/u }
+ );
+ });
+ });
+
+ describe("getAstCode", () => {
+
+ /**
+ * Evaluate the generated code of `getAstCode` function with given code.
+ * @param {ASTNode} ast The AST node to test.
+ * @returns {ASTNode} The result of the evaluation of the generated code.
+ */
+ function test(ast) {
+ const code = getAstCode(ast);
+
+ // eslint-disable-next-line no-new-func
+ return Function(`return ${code};`)();
+ }
+
+ it("should remove `start` and `end` properties", () => {
+ assert.deepStrictEqual(
+ test({ start: 0, end: 1, node: { start: 2, end: 3, value: 4 } }),
+ { node: { value: 4 } }
+ );
+ });
+
+ it("should keep NaN", () => {
+ assert.deepStrictEqual(
+ test({ value: NaN }),
+ { value: NaN }
+ );
+ });
+
+ it("should keep Infinity", () => {
+ assert.deepStrictEqual(
+ test({ value: Infinity }),
+ { value: Infinity }
+ );
+ });
+
+ it("should keep -Infinity", () => {
+ assert.deepStrictEqual(
+ test({ value: -Infinity }),
+ { value: -Infinity }
+ );
+ });
+
+ it("should keep bigint values", () => {
+ assert.deepStrictEqual(
+ test({ value: BigInt("123") }),
+ { value: BigInt("123") }
+ );
+ });
+
+ it("should keep RegExp objects", () => {
+ assert.deepStrictEqual(
+ // eslint-disable-next-line require-unicode-regexp
+ test({ value: /foo/ }),
+ // eslint-disable-next-line require-unicode-regexp
+ { value: /foo/ }
+ );
+ assert.deepStrictEqual(
+ test({ value: /foo/u }),
+ { value: /foo/u }
+ );
+
+ // check about escape sequences of `JSON.stringify`.
+ assert.deepStrictEqual(
+ test({ value: /"foo"/u }),
+ { value: /"foo"/u }
+ );
+ assert.deepStrictEqual(
+ test({ value: /\d\/\d/u }),
+ { value: /\d\/\d/u }
+ );
+ });
+ });
+});
diff --git a/tests/lib/tester.js b/tests/lib/tester.js
index 83aa179f..4bbddd98 100644
--- a/tests/lib/tester.js
+++ b/tests/lib/tester.js
@@ -15,6 +15,115 @@ import * as espree from "../../espree.js";
// Private
//------------------------------------------------------------------------------
+// Prefix to replace values.
+// For example, a bigint value `1n` will be replaced by a string `"5f9c9d32_1n"`.
+// Those prefixes merely are improbable values in test fixtures.
+const Prefix = {
+ bigint: "5f9c9d32_",
+ number: "53b0a1b2_",
+ RegExp: "ca5db4fe_"
+};
+const ReplacedStringLiteralPattern = new RegExp(
+ `"(${Object.values(Prefix).join("|")})([^\\n]*)"`,
+ "gu"
+);
+
+/**
+ * Replace the values JSON cannot handle by strings.
+ * The `replaceToRestoreNonJSONValues` function restores the replaced values.
+ * @param {string} key The key to replace.
+ * @param {any} value The value to replace.
+ * @returns {any} If `value` parameter is a value JSON cannot handle, this
+ * function returns a string value. If `key` parameter is `"start"` or `"end"`,
+ * returns `undefined`. Otherwise, returns `value` parameter as is.
+ * @private
+ */
+function replaceToSaveNonJSONValues(key, value) {
+
+ // Remove `start` and `end` properties because of non-standard.
+ if ((key === "start" || key === "end") && typeof value === "number") {
+ return undefined; // eslint-disable-line no-undefined
+ }
+
+ // Save the values JSON cannot handle.
+ // The `value` property of `Literal` node can have those values.
+ switch (typeof value) {
+ case "bigint":
+ return `${Prefix.bigint}${value}n`;
+ case "number":
+ return Number.isFinite(value) ? value : `${Prefix.number}${value}`;
+ case "object":
+ return !(value instanceof RegExp) ? value : `${Prefix.RegExp}${value}`;
+ case "undefined":
+ throw new Error(`AST cannot have undefined as a property value.\nProperty name is '${key}'`);
+ default:
+ return value;
+ }
+}
+
+/**
+ * Replace the values that the `replaceToSaveNonJSONValues` function replaced by the original values.
+ * @param {string} _key The key to replace.
+ * @param {any} value The value to replace.
+ * @returns {any} If `value` parameter is a replaced value, returns the restored
+ * value. Otherwise, returns `value` parameter as is.
+ * @private
+ */
+function replaceToRestoreNonJSONValues(_key, value) {
+
+ // Restore the values JSON cannot handle.
+ if (typeof value === "string") {
+ if (value.startsWith(Prefix.number)) {
+ return Number(value.slice(Prefix.number.length));
+ }
+ if (value.startsWith(Prefix.bigint)) {
+ return BigInt(value.slice(Prefix.bigint.length, -1));
+ }
+ if (value.startsWith(Prefix.RegExp)) {
+ const regexpString = value.slice(Prefix.RegExp.length);
+ const i = regexpString.lastIndexOf("/");
+ const pattern = regexpString.slice(1, i);
+ const flags = regexpString.slice(i + 1);
+
+ return new RegExp(pattern, flags);
+ }
+ }
+
+ return value;
+}
+
+/**
+ * Convert the string literals that the `replaceToSaveNonJSONValues` function
+ * replaced to the JavaScript code of the original value.
+ * @param {string} jsCodeText The JavaScript code text to convert.
+ * @returns {string} The converted JavaScript code text.
+ * @private
+ */
+function restoreNonJSONValueLiterals(jsCodeText) {
+ return jsCodeText
+ .replace(/\u2028/gu, "\\u2028") // Maybe editors cannot handle U+2028 and U+2029 correctly.
+ .replace(/\u2029/gu, "\\u2029")
+ .replace(ReplacedStringLiteralPattern, (_, prefix, value) => {
+ if (prefix === Prefix.number) {
+ return value; // NaN, Infinity, or -Infinity
+ }
+ if (prefix === Prefix.bigint) {
+ return value; // bigint literals
+ }
+ if (prefix === Prefix.RegExp) {
+
+ // TODO: Generate fallback code for the case that runtime didn't support syntax natively.
+ // Currently, Node.js of the minimum supported version supports all RegExp features.
+ // But new `d` flag is at Stage 3 and maybe it will need fallback code.
+
+ // Parse it as a string literal for restoring escape sequences that `JSON.stringify` created.
+ return JSON.parse(`"${value}"`);
+ }
+
+ throw new Error(`unreachable; unknown prefix ${prefix}`);
+ });
+}
+
/**
* Gets a raw version of the AST that is suitable for comparison. This is necessary
* due to the different order of properties across parsers.
@@ -24,25 +133,39 @@ import * as espree from "../../espree.js";
*/
function getRaw(ast) {
return JSON.parse(
- JSON.stringify(ast, (key, value) => {
- if ((key === "start" || key === "end") && typeof value === "number") {
- return undefined; // eslint-disable-line no-undefined
- }
+ JSON.stringify(ast, replaceToSaveNonJSONValues),
+ replaceToRestoreNonJSONValues
+ );
+}
- // JSON cannot handle BigInt.
- if (typeof value === "bigint") {
- return `$$BIGINT$$${value}`;
- }
+/**
+ * Gets a JavaScript code that generates a given AST node object.
+ * @param {ASTNode} ast The AST to convert.
+ * @returns {string} The JavaScript code that generates `ast` object.
+ */
+function getAstCode(ast) {
+ return restoreNonJSONValueLiterals(
+ JSON.stringify(ast, replaceToSaveNonJSONValues, 4)
+ );
+}
- return value;
- }),
- (_key, value) => {
- if (typeof value === "string" && value.startsWith("$$BIGINT$$")) {
- return BigInt(value.slice("$$BIGINT$$".length));
- }
- return value;
+/**
+ * Parse and normalzie a JavaScript code.
+ * @param {string} jsCodeText The JavaScript code to parse.
+ * @param {Object} parserOptions The parser options to parse.
+ * @param {Object} [options] The options.
+ * @param {boolean} [options.rethrowSyntaxError = false] The flag to rethrow syntax errors.
+ * @returns {Object} The normalized AST.
+ */
+function getExpectedResult(jsCodeText, parserOptions, { rethrowSyntaxError = false } = {}) {
+ try {
+ return getRaw(espree.parse(jsCodeText, parserOptions));
+ } catch (ex) {
+ if (rethrowSyntaxError) {
+ throw ex;
}
- );
+ return { ...getRaw(ex), message: ex.message };
+ }
}
//------------------------------------------------------------------------------
@@ -51,25 +174,13 @@ function getRaw(ast) {
export default {
getRaw,
+ getAstCode,
+ getExpectedResult,
assertMatches(code, config, expected) {
- let result;
-
- try {
- result = espree.parse(code, config);
- result = getRaw(result);
- } catch (ex) {
-
- // if the result is an error, create an error object so deepEqual works
- if (expected.message || expected.description) {
- result = getRaw(ex);
- result.message = ex.message;
- } else {
- throw ex;
- }
-
- }
-
- assert.deepStrictEqual(result, getRaw(expected));
+ assert.deepStrictEqual(
+ getExpectedResult(code, config, { rethrowSyntaxError: !expected.message }),
+ getRaw(expected)
+ );
}
};
diff --git a/tools/update-ecma-version-tests.js b/tools/update-ecma-version-tests.js
new file mode 100644
index 00000000..2b002298
--- /dev/null
+++ b/tools/update-ecma-version-tests.js
@@ -0,0 +1,134 @@
+/**
+ * @fileoverview Generate `.result.js` from `.src.js` in
+ * `tests/fixtures/ecma-version//**` directory.
+ * @author Nicholas C. Zakas
+ * @author Toru Nagashima
+ *
+ * Usage:
+ * node tools/update-ecma-version-tests.js
+ *
+ */
+
+//------------------------------------------------------------------------------
+// Imports
+//------------------------------------------------------------------------------
+
+import path from "path";
+import { fileURLToPath } from "url";
+import util from "util";
+import shelljs from "shelljs";
+import tester from "../tests/lib/tester.js";
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+/**
+ * Find the test cases from a given directory.
+ * Tests are the name of files that end with `.src.js`.
+ * @param {string} directory The root directory to find.
+ * @returns {string[]} The found test names.
+ */
+function findTests(directory) {
+ return shelljs.find(directory)
+ .filter(filename => filename.endsWith(".src.js"))
+ .map(filename => filename.slice(0, -".src.js".length)); // strip off ".src.js"
+}
+
+/**
+ * Write the parse result to the result file (`.result.js`).
+ * @param {Object} result The parse result to write.
+ * @param {string} testResultFilename The path to the result file.
+ * @returns {void}
+ */
+function outputResult(result, testResultFilename) {
+ `export default ${tester.getAstCode(result)};`.to(testResultFilename);
+}
+
+/**
+ * Entry point.
+ * @returns {void}
+ */
+function main() {
+ const thisFilePath = fileURLToPath(import.meta.url);
+ const ecmaVersion = process.argv[2] ?? "";
+ const rootDir = path.resolve(thisFilePath, "../../tests/fixtures/ecma-version", ecmaVersion);
+
+ if (!ecmaVersion) {
+ console.error();
+ console.error("Usage: node tools/update-ecma-version-tests.js ");
+ console.error();
+ console.error(" ... The ECMA version to update tests.");
+ console.error();
+ return;
+ }
+ if (!/^\d+$/u.test(ecmaVersion)) {
+ console.error("Error: The version number must be an positive integer.");
+ return;
+ }
+ if (!shelljs.test("-d", rootDir)) {
+ console.error("Error: %o is must be a directory.", rootDir);
+ return;
+ }
+
+ for (const name of findTests(rootDir)) {
+ const scriptOnly = name.includes("not-strict") || name.includes("edge-cases");
+ const moduleOnly = !scriptOnly && name.includes("modules");
+ const expectedToBeError = name.includes("/invalid-");
+ const expectedToBeOK = name.includes("/valid-");
+ const sourceFilePath = `${path.resolve(rootDir, name)}.src.js`;
+ const resultFilePath = `${path.resolve(rootDir, name)}.result.js`;
+ const moduleResultFilePath = `${path.resolve(rootDir, name)}.module-result.js`;
+ const relSourceFilePath = path.relative(process.cwd(), sourceFilePath);
+ const code = shelljs.cat(sourceFilePath);
+ const parserOptions = {
+ loc: true,
+ range: true,
+ tokens: true,
+ ecmaVersion: Number(ecmaVersion)
+ };
+ const scriptResult = moduleOnly
+ ? null
+ : tester.getExpectedResult(code, { ...parserOptions, sourceType: "script" });
+ const moduleResult = scriptOnly
+ ? null
+ : tester.getExpectedResult(code, { ...parserOptions, sourceType: "module" });
+ const resultsAreSame = util.isDeepStrictEqual(
+ { ...scriptResult, sourceType: null },
+ { ...moduleResult, sourceType: null }
+ );
+
+ if (scriptOnly || moduleOnly || resultsAreSame) {
+ const result = scriptResult ?? moduleResult;
+
+ if (expectedToBeError && typeof result.type === "string") {
+ console.warn("Warn: expected to be syntax error, but succeeded to parse: %o", relSourceFilePath);
+ } else if (expectedToBeOK && typeof result.type !== "string") {
+ console.warn("Warn: expected to succeed to parse, but thrown syntax error: %o", relSourceFilePath);
+ }
+
+ outputResult(result, resultFilePath);
+ } else {
+ console.warn("Warn: got different results between script and module: %o", relSourceFilePath);
+ if (expectedToBeError && typeof scriptResult.type === "string") {
+ console.warn("Warn: expected to be syntax error, but succeeded to parse in script: %o", relSourceFilePath);
+ } else if (expectedToBeOK && typeof scriptResult.type !== "string") {
+ console.warn("Warn: expected to succeed to parse, but thrown syntax error in script: %o", relSourceFilePath);
+ }
+ if (expectedToBeError && typeof moduleResult.type === "string") {
+ console.warn("Warn: expected to be syntax error, but succeeded to parse in module: %o", relSourceFilePath);
+ } else if (expectedToBeOK && typeof moduleResult.type !== "string") {
+ console.warn("Warn: expected to succeed to parse, but thrown syntax error in module: %o", relSourceFilePath);
+ }
+
+ outputResult(scriptResult, resultFilePath);
+ outputResult(moduleResult, moduleResultFilePath);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+// Setup
+//------------------------------------------------------------------------------
+
+main();
diff --git a/tools/update-tests.js b/tools/update-tests.js
index 62e8a782..2957255f 100644
--- a/tools/update-tests.js
+++ b/tools/update-tests.js
@@ -13,7 +13,6 @@
//------------------------------------------------------------------------------
import shelljs from "shelljs";
-import * as espree from "../espree.js";
import tester from "../tests/lib/tester.js";
import path from "path";
import { fileURLToPath } from "url";
@@ -24,16 +23,6 @@ import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
-function getExpectedResult(code, config) {
- try {
- return tester.getRaw(espree.parse(code, config));
- } catch (ex) {
- var raw = tester.getRaw(ex);
- raw.message = ex.message;
- return raw;
- }
-}
-
function getTestFilenames(directory) {
return shelljs.find(directory).filter(function(filename) {
return filename.indexOf(".src.js") > -1;
@@ -51,13 +40,7 @@ function getLibraryFilenames(directory) {
}
function outputResult(result, testResultFilename) {
- let code = `export default ${JSON.stringify(result, (key, value) => {
- return (typeof value === "bigint") ? `bigint<${value}n>` : value;
- }, 4)};`;
-
- code = code.replace(/"bigint<(\d+n)>"/g, "$1");
-
- code.to(testResultFilename);
+ `export default ${tester.getAstCode(result)};`.to(testResultFilename);
}
//------------------------------------------------------------------------------
@@ -65,11 +48,9 @@ function outputResult(result, testResultFilename) {
//------------------------------------------------------------------------------
var FIXTURES_DIR = "./tests/fixtures/ecma-features",
- FIXTURES_VERSION_DIR = "./tests/fixtures/ecma-version",
LIBRARIES_DIR = "./tests/fixtures/libraries";
var testFiles = getTestFilenames(FIXTURES_DIR),
- versionFiles = getTestFilenames(FIXTURES_VERSION_DIR),
libraryFiles = getLibraryFilenames(LIBRARIES_DIR);
libraryFiles.forEach(function(filename) {
@@ -103,20 +84,3 @@ testFiles.forEach(function(filename) {
outputResult(result, testResultFilename);
});
-
-versionFiles.forEach(function(filename) {
-
- var version = Number(filename.substring(0, filename.indexOf("/"))),
- code = shelljs.cat(path.resolve(FIXTURES_VERSION_DIR, filename) + ".src.js"),
- config = {
- loc: true,
- range: true,
- tokens: true,
- ecmaVersion: version
- };
-
- var testResultFilename = path.resolve(__dirname, "..", FIXTURES_VERSION_DIR, filename) + ".result.js",
- result = getExpectedResult(code, config);
-
- outputResult(result, testResultFilename);
-});