Huáng Jùnliàng 2782a549e9
Refactor yield await classification (#12230)
* fix: incomplete ParamKind declaration

* refactor: add expression scope handler

* test: update test262 allowlist

* chore: cleanup

* fix: push expression scope for function body

* fix: push new expression scope for initializer and static block

* test: add more test cases

* fix flow error

* refactor: remove unecessary expression scope

* fix: parameter initializer error should not cross expression scope boundary

* chore: cleanup outdated comments

* fix: do not record async arrow error on ParameterDeclaration

* Update packages/babel-parser/src/util/expression-scope.js

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* polish: clear ancestry declaration error on validate

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-26 11:42:02 -04:00

128 lines
5.4 KiB
JSON

{
"type": "File",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"errors": [
"SyntaxError: Can not use 'await' as identifier inside an async function (1:15)",
"SyntaxError: Can not use 'await' as identifier inside an async function (1:30)"
],
"program": {
"type": "Program",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"expression": {
"type": "ArrowFunctionExpression",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"id": null,
"generator": false,
"async": true,
"params": [
{
"type": "ObjectPattern",
"start":7,"end":39,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":39}},
"properties": [
{
"type": "ObjectProperty",
"start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}},
"extra": {
"shorthand": true
},
"method": false,
"key": {
"type": "Identifier",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"},
"name": "x"
},
"computed": false,
"shorthand": true,
"value": {
"type": "AssignmentPattern",
"start":9,"end":22,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":22}},
"left": {
"type": "Identifier",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"},
"name": "x"
},
"right": {
"type": "ArrayExpression",
"start":13,"end":22,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":22}},
"elements": [
{
"type": "Identifier",
"start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"await"},
"name": "await"
}
]
}
}
},
{
"type": "ObjectProperty",
"start":24,"end":37,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":37}},
"extra": {
"shorthand": true
},
"method": false,
"key": {
"type": "Identifier",
"start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"y"},
"name": "y"
},
"computed": false,
"shorthand": true,
"value": {
"type": "AssignmentPattern",
"start":24,"end":37,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":37}},
"left": {
"type": "Identifier",
"start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"y"},
"name": "y"
},
"right": {
"type": "ObjectExpression",
"start":28,"end":37,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":37}},
"properties": [
{
"type": "ObjectProperty",
"start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}},
"extra": {
"shorthand": true
},
"method": false,
"key": {
"type": "Identifier",
"start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"await"},
"name": "await"
},
"computed": false,
"shorthand": true,
"value": {
"type": "Identifier",
"start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"await"},
"name": "await"
}
}
]
}
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}},
"body": [],
"directives": []
}
}
}
],
"directives": []
}
}