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

80 lines
3.1 KiB
JSON

{
"type": "File",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
"program": {
"type": "Program",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},
"id": {
"type": "Identifier",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"g"},
"name": "g"
},
"generator": true,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start":13,"end":44,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":44}},
"left": {
"type": "Identifier",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"x"},
"name": "x"
},
"right": {
"type": "FunctionExpression",
"start":17,"end":44,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":44}},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":28,"end":44,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":44}},
"body": [
{
"type": "ExpressionStatement",
"start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}},
"expression": {
"type": "CallExpression",
"start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}},
"callee": {
"type": "Identifier",
"start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35},"identifierName":"async"},
"name": "async"
},
"arguments": [
{
"type": "Identifier",
"start":36,"end":41,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":41},"identifierName":"yield"},
"name": "yield"
}
]
}
}
],
"directives": []
}
}
}
],
"body": {
"type": "BlockStatement",
"start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48}},
"body": [],
"directives": []
}
},
{
"type": "EmptyStatement",
"start":48,"end":49,"loc":{"start":{"line":1,"column":48},"end":{"line":1,"column":49}}
}
],
"directives": []
}
}