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

835 lines
22 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 20,
"end": 358,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 58,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 24,
"end": 57,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 24,
"end": 29,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 29,
"end": 57,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 31,
"end": 57,
"ctxt": 0
},
"elemType": {
"type": "TsTypeLiteral",
"span": {
"start": 31,
"end": 55,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 33,
"end": 43,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 42,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 44,
"end": 53,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 45,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 47,
"end": 53,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForOfStatement",
"span": {
"start": 59,
"end": 115,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 64,
"end": 84,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 68,
"end": 84,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 68,
"end": 84,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 73,
"end": 82,
"ctxt": 0
},
"rest": {
"start": 73,
"end": 76,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"value": "restOf",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 88,
"end": 93,
"ctxt": 0
},
"value": "array",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 95,
"end": 115,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 101,
"end": 113,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 101,
"end": 112,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 105,
"end": 111,
"ctxt": 0
},
"value": "restOf",
"optional": false
}
}
]
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 116,
"end": 131,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 120,
"end": 130,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 120,
"end": 122,
"ctxt": 0
},
"value": "xx",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 122,
"end": 130,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 124,
"end": 130,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 132,
"end": 160,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 136,
"end": 159,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 136,
"end": 144,
"ctxt": 0
},
"value": "rrestOff",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 146,
"end": 159,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 149,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 151,
"end": 157,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForOfStatement",
"span": {
"start": 161,
"end": 223,
"ctxt": 0
},
"await": null,
"left": {
"type": "ObjectPattern",
"span": {
"start": 166,
"end": 188,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 171,
"end": 173,
"ctxt": 0
},
"value": "xx",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 175,
"end": 186,
"ctxt": 0
},
"rest": {
"start": 175,
"end": 178,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 178,
"end": 186,
"ctxt": 0
},
"value": "rrestOff",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 192,
"end": 197,
"ctxt": 0
},
"value": "array",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 200,
"end": 223,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 206,
"end": 221,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 206,
"end": 220,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 207,
"end": 209,
"ctxt": 0
},
"value": "xx",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 211,
"end": 219,
"ctxt": 0
},
"value": "rrestOff",
"optional": false
}
}
]
}
}
]
}
},
{
"type": "ForOfStatement",
"span": {
"start": 224,
"end": 358,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 229,
"end": 241,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 235,
"end": 241,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 235,
"end": 241,
"ctxt": 0
},
"value": "norest",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "CallExpression",
"span": {
"start": 245,
"end": 286,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 245,
"end": 254,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 245,
"end": 250,
"ctxt": 0
},
"value": "array",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 251,
"end": 254,
"ctxt": 0
},
"value": "map",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 255,
"end": 285,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "ParenthesisExpression",
"span": {
"start": 260,
"end": 285,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 261,
"end": 284,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 263,
"end": 266,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 266,
"end": 267,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 272,
"end": 282,
"ctxt": 0
},
"value": "a string",
"raw": "'a string'"
}
}
]
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 288,
"end": 358,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 294,
"end": 315,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 294,
"end": 314,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 295,
"end": 303,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 295,
"end": 301,
"ctxt": 0
},
"value": "norest",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 305,
"end": 313,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 305,
"end": 311,
"ctxt": 0
},
"value": "norest",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
}
}
]
}
}
],
"interpreter": null
}