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

839 lines
22 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 19,
"end": 357,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 19,
"end": 57,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 23,
"end": 56,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 23,
"end": 28,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 28,
"end": 56,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 30,
"end": 56,
"ctxt": 0
},
"elemType": {
"type": "TsTypeLiteral",
"span": {
"start": 30,
"end": 54,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 32,
"end": 42,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 41,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 44,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 46,
"end": 52,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForOfStatement",
"span": {
"start": 58,
"end": 114,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 63,
"end": 83,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 67,
"end": 83,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 67,
"end": 83,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 72,
"end": 81,
"ctxt": 0
},
"rest": {
"start": 72,
"end": 75,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"value": "restOf",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 87,
"end": 92,
"ctxt": 0
},
"value": "array",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 94,
"end": 114,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 100,
"end": 112,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 100,
"end": 111,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"value": "restOf",
"optional": false
}
}
]
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 130,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 119,
"end": 129,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 119,
"end": 121,
"ctxt": 0
},
"value": "xx",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 121,
"end": 129,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 123,
"end": 129,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 131,
"end": 159,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 135,
"end": 158,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 135,
"end": 143,
"ctxt": 0
},
"value": "rrestOff",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 143,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 145,
"end": 158,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 147,
"end": 156,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 148,
"end": 156,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 150,
"end": 156,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForOfStatement",
"span": {
"start": 160,
"end": 222,
"ctxt": 0
},
"await": null,
"left": {
"type": "ObjectPattern",
"span": {
"start": 165,
"end": 187,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 170,
"end": 172,
"ctxt": 0
},
"value": "xx",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 174,
"end": 185,
"ctxt": 0
},
"rest": {
"start": 174,
"end": 177,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 177,
"end": 185,
"ctxt": 0
},
"value": "rrestOff",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 191,
"end": 196,
"ctxt": 0
},
"value": "array",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 199,
"end": 222,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 205,
"end": 220,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 205,
"end": 219,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 206,
"end": 208,
"ctxt": 0
},
"value": "xx",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 210,
"end": 218,
"ctxt": 0
},
"value": "rrestOff",
"optional": false
}
}
]
}
}
]
}
},
{
"type": "ForOfStatement",
"span": {
"start": 223,
"end": 357,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 228,
"end": 240,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 234,
"end": 240,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 234,
"end": 240,
"ctxt": 0
},
"value": "norest",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "CallExpression",
"span": {
"start": 244,
"end": 285,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 244,
"end": 253,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 244,
"end": 249,
"ctxt": 0
},
"value": "array",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 250,
"end": 253,
"ctxt": 0
},
"value": "map",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 254,
"end": 284,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 254,
"end": 255,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "ParenthesisExpression",
"span": {
"start": 259,
"end": 284,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 260,
"end": 283,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 262,
"end": 265,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 271,
"end": 281,
"ctxt": 0
},
"value": "a string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 287,
"end": 357,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 293,
"end": 314,
"ctxt": 0
},
"expression": {
"type": "ArrayExpression",
"span": {
"start": 293,
"end": 313,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 294,
"end": 302,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 294,
"end": 300,
"ctxt": 0
},
"value": "norest",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 304,
"end": 312,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 304,
"end": 310,
"ctxt": 0
},
"value": "norest",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 311,
"end": 312,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
}
}
]
}
}
],
"interpreter": null
}