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

58 lines
2.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:14)"
],
"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": "ExpressionStatement",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":25,"index":25}},
"expression": {
"type": "FunctionExpression",
"start":1,"end":24,"loc":{"start":{"line":1,"column":1,"index":1},"end":{"line":1,"column":24,"index":24}},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":12,"end":24,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":24,"index":24}},
"body": [
{
"type": "ExpressionStatement",
"start":14,"end":22,"loc":{"start":{"line":1,"column":14,"index":14},"end":{"line":1,"column":22,"index":22}},
"expression": {
"type": "YieldExpression",
"start":14,"end":21,"loc":{"start":{"line":1,"column":14,"index":14},"end":{"line":1,"column":21,"index":21}},
"delegate": false,
"argument": {
"type": "NumericLiteral",
"start":20,"end":21,"loc":{"start":{"line":1,"column":20,"index":20},"end":{"line":1,"column":21,"index":21}},
"extra": {
"rawValue": 3,
"raw": "3"
},
"value": 3
}
}
}
],
"directives": []
},
"extra": {
"parenthesized": true,
"parenStart": 0
}
}
}
],
"directives": []
}
}