Files
liuxingbaoyuandGitHub 5b9e724df1 Add allowYieldOutsideFunction to parser (#17149)
* allowYieldOutsideFunction

* dts

* review

* template

* Revert "template"

This reverts commit 324e0893f51b5c8dd2c9f546e0cd3cc4441c5b56.

* improve error

* review
2025-03-21 11:19:58 +01:00

74 lines
3.1 KiB
JSON

{
"type": "File",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":25,"index":25}},
"errors": [
"SyntaxError: 'yield' is only allowed within generator functions. (1:12)"
],
"program": {
"type": "Program",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":25,"index":25}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "VariableDeclaration",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":25,"index":25}},
"declarations": [
{
"type": "VariableDeclarator",
"start":4,"end":24,"loc":{"start":{"line":1,"column":4,"index":4},"end":{"line":1,"column":24,"index":24}},
"id": {
"type": "ObjectPattern",
"start":4,"end":20,"loc":{"start":{"line":1,"column":4,"index":4},"end":{"line":1,"column":20,"index":20}},
"properties": [
{
"type": "ObjectProperty",
"start":5,"end":19,"loc":{"start":{"line":1,"column":5,"index":5},"end":{"line":1,"column":19,"index":19}},
"key": {
"type": "Identifier",
"start":5,"end":6,"loc":{"start":{"line":1,"column":5,"index":5},"end":{"line":1,"column":6,"index":6},"identifierName":"x"},
"name": "x"
},
"computed": false,
"method": false,
"shorthand": false,
"value": {
"type": "AssignmentPattern",
"start":8,"end":19,"loc":{"start":{"line":1,"column":8,"index":8},"end":{"line":1,"column":19,"index":19}},
"left": {
"type": "Identifier",
"start":8,"end":9,"loc":{"start":{"line":1,"column":8,"index":8},"end":{"line":1,"column":9,"index":9},"identifierName":"y"},
"name": "y"
},
"right": {
"type": "YieldExpression",
"start":12,"end":19,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":19,"index":19}},
"delegate": false,
"argument": {
"type": "NumericLiteral",
"start":18,"end":19,"loc":{"start":{"line":1,"column":18,"index":18},"end":{"line":1,"column":19,"index":19}},
"extra": {
"rawValue": 3,
"raw": "3"
},
"value": 3
}
}
}
}
]
},
"init": {
"type": "Identifier",
"start":23,"end":24,"loc":{"start":{"line":1,"column":23,"index":23},"end":{"line":1,"column":24,"index":24},"identifierName":"z"},
"name": "z"
}
}
],
"kind": "var"
}
],
"directives": []
}
}