swc/crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment3.json

903 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 304,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 24,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 7,
"end": 23,
"ctxt": 0
},
"id": {
"type": "ArrayPattern",
"span": {
"start": 7,
"end": 17,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 11,
"end": 16,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 11,
"end": 12,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 15,
"end": 16,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 20,
"end": 23,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 31,
"end": 61,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 37,
"end": 60,
"ctxt": 0
},
"id": {
"type": "ArrayPattern",
"span": {
"start": 37,
"end": 54,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 41,
"end": 46,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 45,
"end": 46,
"ctxt": 0
},
"value": "c",
"optional": false
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 48,
"end": 53,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "e",
"optional": false
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 81,
"end": 118,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 87,
"end": 117,
"ctxt": 0
},
"id": {
"type": "ArrayPattern",
"span": {
"start": 87,
"end": 111,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 91,
"end": 96,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 95,
"end": 96,
"ctxt": 0
},
"value": "f",
"optional": false
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 98,
"end": 103,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 98,
"end": 99,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": "i",
"optional": false
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 105,
"end": 110,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "f",
"optional": false
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 114,
"end": 117,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 139,
"end": 178,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 139,
"end": 177,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 139,
"end": 172,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 150,
"end": 160,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ArrayPattern",
"span": {
"start": 150,
"end": 160,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 154,
"end": 159,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 140,
"end": 171,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 162,
"end": 171,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 179,
"end": 238,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 179,
"end": 237,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 179,
"end": 232,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 190,
"end": 207,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ArrayPattern",
"span": {
"start": 190,
"end": 207,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 194,
"end": 199,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "c",
"optional": false
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "e",
"optional": false
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 180,
"end": 231,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 209,
"end": 231,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 233,
"end": 236,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 239,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 239,
"end": 304,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 239,
"end": 299,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 250,
"end": 274,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ArrayPattern",
"span": {
"start": 250,
"end": 274,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 254,
"end": 259,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 254,
"end": 255,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 258,
"end": 259,
"ctxt": 0
},
"value": "f",
"optional": false
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 261,
"end": 266,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": "i",
"optional": false
},
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 268,
"end": 273,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 272,
"end": 273,
"ctxt": 0
},
"value": "f",
"optional": false
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 240,
"end": 298,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 276,
"end": 298,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 300,
"end": 303,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}