mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* add VoidPattern definition * update types artifacts * parse void binding * print void binding * fix typing errors * update parser typings * fix: remove VoidPattern from ForXStatement.left * fix typing errors * add Babel 8 tests * require syntaxType option * add test for object-rest-spread change * feat(types): disallow void pattern in var/let/const declaration * fix: allow nested void pattern in catch param * improve UnexpectedVoidPattern error message * remove R&T integration parser tests * polish: throw different error when CoverDiscardElement is parsed * Update expression.ts Co-authored-by: liuxingbaoyu <[email protected]> * update discardBinding plugin option types --------- Co-authored-by: liuxingbaoyu <[email protected]>
471 lines
22 KiB
JSON
471 lines
22 KiB
JSON
{
|
|
"type": "File",
|
|
"start":0,"end":599,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":34,"column":1,"index":599}},
|
|
"program": {
|
|
"type": "Program",
|
|
"start":0,"end":599,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":34,"column":1,"index":599}},
|
|
"sourceType": "script",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":0,"end":47,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":4,"column":1,"index":47}},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":28,"end":45,"loc":{"start":{"line":3,"column":2,"index":28},"end":{"line":3,"column":19,"index":45}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":34,"end":44,"loc":{"start":{"line":3,"column":8,"index":34},"end":{"line":3,"column":18,"index":44}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":34,"end":38,"loc":{"start":{"line":3,"column":8,"index":34},"end":{"line":3,"column":12,"index":38}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":41,"end":44,"loc":{"start":{"line":3,"column":15,"index":41},"end":{"line":3,"column":18,"index":44}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":41,"end":42,"loc":{"start":{"line":3,"column":15,"index":41},"end":{"line":3,"column":16,"index":42},"identifierName":"f"},
|
|
"name": "f"
|
|
},
|
|
"arguments": []
|
|
}
|
|
}
|
|
],
|
|
"kind": "using",
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using 1 declarator",
|
|
"start":4,"end":25,"loc":{"start":{"line":2,"column":2,"index":4},"end":{"line":2,"column":23,"index":25}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":48,"end":108,"loc":{"start":{"line":5,"column":0,"index":48},"end":{"line":8,"column":1,"index":108}},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":77,"end":106,"loc":{"start":{"line":7,"column":2,"index":77},"end":{"line":7,"column":31,"index":106}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":83,"end":93,"loc":{"start":{"line":7,"column":8,"index":83},"end":{"line":7,"column":18,"index":93}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":83,"end":87,"loc":{"start":{"line":7,"column":8,"index":83},"end":{"line":7,"column":12,"index":87}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":90,"end":93,"loc":{"start":{"line":7,"column":15,"index":90},"end":{"line":7,"column":18,"index":93}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":90,"end":91,"loc":{"start":{"line":7,"column":15,"index":90},"end":{"line":7,"column":16,"index":91},"identifierName":"f"},
|
|
"name": "f"
|
|
},
|
|
"arguments": []
|
|
}
|
|
},
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":95,"end":105,"loc":{"start":{"line":7,"column":20,"index":95},"end":{"line":7,"column":30,"index":105}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":95,"end":99,"loc":{"start":{"line":7,"column":20,"index":95},"end":{"line":7,"column":24,"index":99}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":102,"end":105,"loc":{"start":{"line":7,"column":27,"index":102},"end":{"line":7,"column":30,"index":105}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":102,"end":103,"loc":{"start":{"line":7,"column":27,"index":102},"end":{"line":7,"column":28,"index":103},"identifierName":"g"},
|
|
"name": "g"
|
|
},
|
|
"arguments": []
|
|
}
|
|
}
|
|
],
|
|
"kind": "using",
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using 2 declarators",
|
|
"start":52,"end":74,"loc":{"start":{"line":6,"column":2,"index":52},"end":{"line":6,"column":24,"index":74}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":109,"end":190,"loc":{"start":{"line":9,"column":0,"index":109},"end":{"line":12,"column":1,"index":190}},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":162,"end":188,"loc":{"start":{"line":11,"column":2,"index":162},"end":{"line":11,"column":28,"index":188}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":168,"end":178,"loc":{"start":{"line":11,"column":8,"index":168},"end":{"line":11,"column":18,"index":178}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":168,"end":172,"loc":{"start":{"line":11,"column":8,"index":168},"end":{"line":11,"column":12,"index":172}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":175,"end":178,"loc":{"start":{"line":11,"column":15,"index":175},"end":{"line":11,"column":18,"index":178}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":175,"end":176,"loc":{"start":{"line":11,"column":15,"index":175},"end":{"line":11,"column":16,"index":176},"identifierName":"f"},
|
|
"name": "f"
|
|
},
|
|
"arguments": []
|
|
}
|
|
},
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":180,"end":187,"loc":{"start":{"line":11,"column":20,"index":180},"end":{"line":11,"column":27,"index":187}},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start":180,"end":181,"loc":{"start":{"line":11,"column":20,"index":180},"end":{"line":11,"column":21,"index":181},"identifierName":"x"},
|
|
"name": "x"
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":184,"end":187,"loc":{"start":{"line":11,"column":24,"index":184},"end":{"line":11,"column":27,"index":187}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":184,"end":185,"loc":{"start":{"line":11,"column":24,"index":184},"end":{"line":11,"column":25,"index":185},"identifierName":"g"},
|
|
"name": "g"
|
|
},
|
|
"arguments": []
|
|
}
|
|
}
|
|
],
|
|
"kind": "using",
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using void declarator and normal declarator",
|
|
"start":113,"end":159,"loc":{"start":{"line":10,"column":2,"index":113},"end":{"line":10,"column":48,"index":159}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":191,"end":251,"loc":{"start":{"line":13,"column":0,"index":191},"end":{"line":16,"column":1,"index":251}},
|
|
"body": [
|
|
{
|
|
"type": "ForOfStatement",
|
|
"start":227,"end":249,"loc":{"start":{"line":15,"column":2,"index":227},"end":{"line":15,"column":24,"index":249}},
|
|
"await": false,
|
|
"left": {
|
|
"type": "VariableDeclaration",
|
|
"start":231,"end":241,"loc":{"start":{"line":15,"column":6,"index":231},"end":{"line":15,"column":16,"index":241}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":237,"end":241,"loc":{"start":{"line":15,"column":12,"index":237},"end":{"line":15,"column":16,"index":241}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":237,"end":241,"loc":{"start":{"line":15,"column":12,"index":237},"end":{"line":15,"column":16,"index":241}}
|
|
},
|
|
"init": null
|
|
}
|
|
],
|
|
"kind": "using"
|
|
},
|
|
"right": {
|
|
"type": "ArrayExpression",
|
|
"start":245,"end":247,"loc":{"start":{"line":15,"column":20,"index":245},"end":{"line":15,"column":22,"index":247}},
|
|
"elements": []
|
|
},
|
|
"body": {
|
|
"type": "EmptyStatement",
|
|
"start":248,"end":249,"loc":{"start":{"line":15,"column":23,"index":248},"end":{"line":15,"column":24,"index":249}}
|
|
},
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using declarator in for-of",
|
|
"start":195,"end":224,"loc":{"start":{"line":14,"column":2,"index":195},"end":{"line":14,"column":31,"index":224}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"start":252,"end":599,"loc":{"start":{"line":17,"column":0,"index":252},"end":{"line":34,"column":1,"index":599}},
|
|
"expression": {
|
|
"type": "ArrowFunctionExpression",
|
|
"start":252,"end":599,"loc":{"start":{"line":17,"column":0,"index":252},"end":{"line":34,"column":1,"index":599}},
|
|
"id": null,
|
|
"generator": false,
|
|
"async": true,
|
|
"params": [],
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"start":264,"end":599,"loc":{"start":{"line":17,"column":12,"index":264},"end":{"line":34,"column":1,"index":599}},
|
|
"body": [
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":268,"end":333,"loc":{"start":{"line":18,"column":2,"index":268},"end":{"line":21,"column":3,"index":333}},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":306,"end":329,"loc":{"start":{"line":20,"column":4,"index":306},"end":{"line":20,"column":27,"index":329}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":318,"end":328,"loc":{"start":{"line":20,"column":16,"index":318},"end":{"line":20,"column":26,"index":328}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":318,"end":322,"loc":{"start":{"line":20,"column":16,"index":318},"end":{"line":20,"column":20,"index":322}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":325,"end":328,"loc":{"start":{"line":20,"column":23,"index":325},"end":{"line":20,"column":26,"index":328}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":325,"end":326,"loc":{"start":{"line":20,"column":23,"index":325},"end":{"line":20,"column":24,"index":326},"identifierName":"f"},
|
|
"name": "f"
|
|
},
|
|
"arguments": []
|
|
}
|
|
}
|
|
],
|
|
"kind": "await using",
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using 1 declarator",
|
|
"start":274,"end":301,"loc":{"start":{"line":19,"column":4,"index":274},"end":{"line":19,"column":31,"index":301}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":336,"end":414,"loc":{"start":{"line":22,"column":2,"index":336},"end":{"line":25,"column":3,"index":414}},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":375,"end":410,"loc":{"start":{"line":24,"column":4,"index":375},"end":{"line":24,"column":39,"index":410}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":387,"end":397,"loc":{"start":{"line":24,"column":16,"index":387},"end":{"line":24,"column":26,"index":397}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":387,"end":391,"loc":{"start":{"line":24,"column":16,"index":387},"end":{"line":24,"column":20,"index":391}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":394,"end":397,"loc":{"start":{"line":24,"column":23,"index":394},"end":{"line":24,"column":26,"index":397}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":394,"end":395,"loc":{"start":{"line":24,"column":23,"index":394},"end":{"line":24,"column":24,"index":395},"identifierName":"f"},
|
|
"name": "f"
|
|
},
|
|
"arguments": []
|
|
}
|
|
},
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":399,"end":409,"loc":{"start":{"line":24,"column":28,"index":399},"end":{"line":24,"column":38,"index":409}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":399,"end":403,"loc":{"start":{"line":24,"column":28,"index":399},"end":{"line":24,"column":32,"index":403}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":406,"end":409,"loc":{"start":{"line":24,"column":35,"index":406},"end":{"line":24,"column":38,"index":409}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":406,"end":407,"loc":{"start":{"line":24,"column":35,"index":406},"end":{"line":24,"column":36,"index":407},"identifierName":"g"},
|
|
"name": "g"
|
|
},
|
|
"arguments": []
|
|
}
|
|
}
|
|
],
|
|
"kind": "await using",
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using 2 declarators",
|
|
"start":342,"end":370,"loc":{"start":{"line":23,"column":4,"index":342},"end":{"line":23,"column":32,"index":370}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":417,"end":516,"loc":{"start":{"line":26,"column":2,"index":417},"end":{"line":29,"column":3,"index":516}},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":480,"end":512,"loc":{"start":{"line":28,"column":4,"index":480},"end":{"line":28,"column":36,"index":512}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":492,"end":502,"loc":{"start":{"line":28,"column":16,"index":492},"end":{"line":28,"column":26,"index":502}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":492,"end":496,"loc":{"start":{"line":28,"column":16,"index":492},"end":{"line":28,"column":20,"index":496}}
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":499,"end":502,"loc":{"start":{"line":28,"column":23,"index":499},"end":{"line":28,"column":26,"index":502}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":499,"end":500,"loc":{"start":{"line":28,"column":23,"index":499},"end":{"line":28,"column":24,"index":500},"identifierName":"f"},
|
|
"name": "f"
|
|
},
|
|
"arguments": []
|
|
}
|
|
},
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":504,"end":511,"loc":{"start":{"line":28,"column":28,"index":504},"end":{"line":28,"column":35,"index":511}},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start":504,"end":505,"loc":{"start":{"line":28,"column":28,"index":504},"end":{"line":28,"column":29,"index":505},"identifierName":"x"},
|
|
"name": "x"
|
|
},
|
|
"init": {
|
|
"type": "CallExpression",
|
|
"start":508,"end":511,"loc":{"start":{"line":28,"column":32,"index":508},"end":{"line":28,"column":35,"index":511}},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"start":508,"end":509,"loc":{"start":{"line":28,"column":32,"index":508},"end":{"line":28,"column":33,"index":509},"identifierName":"g"},
|
|
"name": "g"
|
|
},
|
|
"arguments": []
|
|
}
|
|
}
|
|
],
|
|
"kind": "await using",
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using void declarator and normal declarator",
|
|
"start":423,"end":475,"loc":{"start":{"line":27,"column":4,"index":423},"end":{"line":27,"column":56,"index":475}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
{
|
|
"type": "BlockStatement",
|
|
"start":519,"end":597,"loc":{"start":{"line":30,"column":2,"index":519},"end":{"line":33,"column":3,"index":597}},
|
|
"body": [
|
|
{
|
|
"type": "ForOfStatement",
|
|
"start":565,"end":593,"loc":{"start":{"line":32,"column":4,"index":565},"end":{"line":32,"column":32,"index":593}},
|
|
"await": false,
|
|
"left": {
|
|
"type": "VariableDeclaration",
|
|
"start":569,"end":585,"loc":{"start":{"line":32,"column":8,"index":569},"end":{"line":32,"column":24,"index":585}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":581,"end":585,"loc":{"start":{"line":32,"column":20,"index":581},"end":{"line":32,"column":24,"index":585}},
|
|
"id": {
|
|
"type": "VoidPattern",
|
|
"start":581,"end":585,"loc":{"start":{"line":32,"column":20,"index":581},"end":{"line":32,"column":24,"index":585}}
|
|
},
|
|
"init": null
|
|
}
|
|
],
|
|
"kind": "await using"
|
|
},
|
|
"right": {
|
|
"type": "ArrayExpression",
|
|
"start":589,"end":591,"loc":{"start":{"line":32,"column":28,"index":589},"end":{"line":32,"column":30,"index":591}},
|
|
"elements": []
|
|
},
|
|
"body": {
|
|
"type": "EmptyStatement",
|
|
"start":592,"end":593,"loc":{"start":{"line":32,"column":31,"index":592},"end":{"line":32,"column":32,"index":593}}
|
|
},
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using declarator in for-of",
|
|
"start":525,"end":560,"loc":{"start":{"line":31,"column":4,"index":525},"end":{"line":31,"column":39,"index":560}}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
"comments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using 1 declarator",
|
|
"start":4,"end":25,"loc":{"start":{"line":2,"column":2,"index":4},"end":{"line":2,"column":23,"index":25}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using 2 declarators",
|
|
"start":52,"end":74,"loc":{"start":{"line":6,"column":2,"index":52},"end":{"line":6,"column":24,"index":74}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using void declarator and normal declarator",
|
|
"start":113,"end":159,"loc":{"start":{"line":10,"column":2,"index":113},"end":{"line":10,"column":48,"index":159}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " using declarator in for-of",
|
|
"start":195,"end":224,"loc":{"start":{"line":14,"column":2,"index":195},"end":{"line":14,"column":31,"index":224}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using 1 declarator",
|
|
"start":274,"end":301,"loc":{"start":{"line":19,"column":4,"index":274},"end":{"line":19,"column":31,"index":301}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using 2 declarators",
|
|
"start":342,"end":370,"loc":{"start":{"line":23,"column":4,"index":342},"end":{"line":23,"column":32,"index":370}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using void declarator and normal declarator",
|
|
"start":423,"end":475,"loc":{"start":{"line":27,"column":4,"index":423},"end":{"line":27,"column":56,"index":475}}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " await using declarator in for-of",
|
|
"start":525,"end":560,"loc":{"start":{"line":31,"column":4,"index":525},"end":{"line":31,"column":39,"index":560}}
|
|
}
|
|
]
|
|
}
|