Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse
await using
declarations (#15520)
- Loading branch information
Showing
90 changed files
with
3,148 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/await-using-declarations/basic/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
/*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/await-using-declarations/basic/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
/*0*/await using /*2*/b /*3*/ = /*4*/f() /*5*/; /*1*/ | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/await-using-declarations/for-using-init/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
/*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/await-using-declarations/for-using-init/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
/*0*/for /*1*/ /*8*/ /*9*/ ( /*2*/await using /*4*/b /*5*/ = /*6*/x /*3*/ /*7*/;;) /*10*/; | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-generator/test/fixtures/await-using-declarations/for-using-of/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
async function f() { | ||
{ | ||
/*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; | ||
} | ||
{ | ||
/*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-generator/test/fixtures/await-using-declarations/for-using-of/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
async function f() { | ||
{ | ||
/*0*/for /*1*/ ( /*2*/await using /*4*/b /*3*/ /*5*/ of /*6*/x /*7*/) /*8*/; | ||
} | ||
{ | ||
/*0*/for /*1*/ /*2*/ await ( /*3*/await using /*5*/b /*4*/ /*6*/ of /*7*/x /*8*/) /*9*/; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/await-using-declarations/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["explicitResourceManagement"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,7 @@ | |
}, | ||
{ | ||
"enum": [ | ||
"asyncDoExpressions", | ||
"asyncGenerators", | ||
"bigInt", | ||
"classPrivateMethods", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...ages/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using in foo; | ||
} |
55 changes: 55 additions & 0 deletions
55
...s/babel-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-in/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start":0,"end":44,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":44}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":15,"end":16,"loc":{"start":{"line":1,"column":15,"index":15},"end":{"line":1,"column":16,"index":16},"identifierName":"f"}, | ||
"name": "f" | ||
}, | ||
"generator": false, | ||
"async": true, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":19,"end":44,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":3,"column":1,"index":44}}, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":23,"end":42,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":21,"index":42}}, | ||
"expression": { | ||
"type": "BinaryExpression", | ||
"start":23,"end":41,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":20,"index":41}}, | ||
"left": { | ||
"type": "AwaitExpression", | ||
"start":23,"end":34,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":13,"index":34}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":29,"end":34,"loc":{"start":{"line":2,"column":8,"index":29},"end":{"line":2,"column":13,"index":34},"identifierName":"using"}, | ||
"name": "using" | ||
} | ||
}, | ||
"operator": "in", | ||
"right": { | ||
"type": "Identifier", | ||
"start":38,"end":41,"loc":{"start":{"line":2,"column":17,"index":38},"end":{"line":2,"column":20,"index":41},"identifierName":"foo"}, | ||
"name": "foo" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...el-parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using instanceof foo; | ||
} |
55 changes: 55 additions & 0 deletions
55
...parser/test/fixtures/es2017/async-functions/valid-await-expr-using-instanceof/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start":0,"end":52,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":52}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":15,"end":16,"loc":{"start":{"line":1,"column":15,"index":15},"end":{"line":1,"column":16,"index":16},"identifierName":"f"}, | ||
"name": "f" | ||
}, | ||
"generator": false, | ||
"async": true, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":19,"end":52,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":3,"column":1,"index":52}}, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":23,"end":50,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":29,"index":50}}, | ||
"expression": { | ||
"type": "BinaryExpression", | ||
"start":23,"end":49,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":28,"index":49}}, | ||
"left": { | ||
"type": "AwaitExpression", | ||
"start":23,"end":34,"loc":{"start":{"line":2,"column":2,"index":23},"end":{"line":2,"column":13,"index":34}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":29,"end":34,"loc":{"start":{"line":2,"column":8,"index":29},"end":{"line":2,"column":13,"index":34},"identifierName":"using"}, | ||
"name": "using" | ||
} | ||
}, | ||
"operator": "instanceof", | ||
"right": { | ||
"type": "Identifier", | ||
"start":46,"end":49,"loc":{"start":{"line":2,"column":25,"index":46},"end":{"line":2,"column":28,"index":49},"identifierName":"foo"}, | ||
"name": "foo" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
.../experimental/_no-plugin/explicit-resource-management-variable-declaration-async/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using reader = getReader(); | ||
} |
3 changes: 3 additions & 0 deletions
3
...erimental/_no-plugin/explicit-resource-management-variable-declaration-async/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"throws": "This experimental syntax requires enabling the parser plugin: \"explicitResourceManagement\". (2:2)" | ||
} |
9 changes: 9 additions & 0 deletions
9
...experimental/async-explicit-resource-management/invalid-duplicate-using-bindings/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
async function f() { | ||
{ | ||
await using f, f = foo(); | ||
} | ||
{ | ||
await using g = foo(); | ||
await using g = foo(); | ||
} | ||
} |
Oops, something went wrong.