Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Support top-level await and regexp match indices #505

Merged
merged 10 commits into from Jun 24, 2021
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -31,7 +31,7 @@
},
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^8.2.2",
"acorn": "^8.4.0",
"acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^2.1.0"
},
Expand Down
@@ -0,0 +1,196 @@
export default {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 25
}
},
"range": [
0,
25
],
"body": [
{
"type": "VariableDeclaration",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 25
}
},
"range": [
0,
25
],
"declarations": [
{
"type": "VariableDeclarator",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 24
}
},
"range": [
6,
24
],
"id": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
6,
9
],
"name": "re1"
},
"init": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 24
}
},
"range": [
12,
24
],

// /d flag no supported in Node.js 12 or 14 yet
"value": /^(12|14)\./.test(process.versions.node) ? null : eval("/a+(<Z>z)?/d"),
"raw": "/a+(<Z>z)?/d",
"regex": {
"pattern": "a+(<Z>z)?",
"flags": "d"
}
}
}
],
"kind": "const"
}
],
"sourceType": "script",
"tokens": [
{
"type": "Keyword",
"value": "const",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
0,
5
]
},
{
"type": "Identifier",
"value": "re1",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
6,
9
]
},
{
"type": "Punctuator",
"value": "=",
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
10,
11
]
},
{
"type": "RegularExpression",
"value": "/a+(<Z>z)?/d",
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 24
}
},
"range": [
12,
24
],
"regex": {
"flags": "d",
"pattern": "a+(<Z>z)?"
}
},
{
"type": "Punctuator",
"value": ";",
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 25
}
},
"range": [
24,
25
]
}
]
};
@@ -0,0 +1 @@
const re1 = /a+(<Z>z)?/d;
183 changes: 183 additions & 0 deletions tests/fixtures/ecma-version/13/top-level-await/top-await.result.js
@@ -0,0 +1,183 @@
export default {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"range": [
0,
12
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"range": [
0,
12
],
"expression": {
"type": "AwaitExpression",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
0,
11
],
"argument": {
"type": "CallExpression",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
6,
11
],
"callee": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
6,
9
],
"name": "foo"
},
"arguments": [],
"optional": false
}
}
}
],
"sourceType": "script",
nzakas marked this conversation as resolved.
Show resolved Hide resolved
"tokens": [
{
"type": "Identifier",
"value": "await",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
0,
5
]
},
{
"type": "Identifier",
"value": "foo",
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
6,
9
]
},
{
"type": "Punctuator",
"value": "(",
"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
]
}
]
};
@@ -0,0 +1 @@
await foo();