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

834 lines
22 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 501,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 25,
"end": 28,
"ctxt": 0
},
"value": "fun",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 29,
"end": 52,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 29,
"end": 52,
"ctxt": 0
},
"rest": {
"start": 29,
"end": 32,
"ctxt": 0
},
"argument": {
"type": "ArrayPattern",
"span": {
"start": 32,
"end": 38,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 38,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 40,
"end": 52,
"ctxt": 0
},
"elemType": {
"type": "TsTupleType",
"span": {
"start": 40,
"end": 50,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsTypeReference",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"typeParams": null
}
},
{
"type": "TsTupleElement",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsTypeReference",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"typeParams": null
}
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 16,
"end": 57,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 54,
"end": 57,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 58,
"end": 90,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 58,
"end": 89,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"value": "fun",
"optional": false
},
"arguments": [
{
"spread": {
"start": 62,
"end": 65,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 65,
"end": 88,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 69,
"end": 88,
"ctxt": 0
},
"value": "FooIteratorIterator",
"optional": false
},
"arguments": null,
"typeArguments": null
}
}
],
"typeArguments": null
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 91,
"end": 106,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 113,
"end": 116,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 107,
"end": 134,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 141,
"end": 152,
"ctxt": 0
},
"value": "FooIterator",
"optional": false
},
"declare": false,
"span": {
"start": 135,
"end": 309,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 159,
"end": 253,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 159,
"end": 163,
"ctxt": 0
},
"value": "next",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 159,
"end": 253,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 166,
"end": 253,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 176,
"end": 247,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 183,
"end": 246,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 197,
"end": 202,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 204,
"end": 211,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 208,
"end": 211,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"arguments": null,
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 225,
"end": 229,
"ctxt": 0
},
"value": "done",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 231,
"end": 236,
"ctxt": 0
},
"value": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 259,
"end": 307,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 259,
"end": 276,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 260,
"end": 275,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"value": "Symbol",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 267,
"end": 275,
"ctxt": 0
},
"value": "iterator",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 259,
"end": 307,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 279,
"end": 307,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 289,
"end": 301,
"ctxt": 0
},
"argument": {
"type": "ThisExpression",
"span": {
"start": 296,
"end": 300,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 317,
"end": 336,
"ctxt": 0
},
"value": "FooIteratorIterator",
"optional": false
},
"declare": false,
"span": {
"start": 311,
"end": 501,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 343,
"end": 445,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 343,
"end": 347,
"ctxt": 0
},
"value": "next",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 343,
"end": 445,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 350,
"end": 445,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 360,
"end": 439,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 367,
"end": 438,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 381,
"end": 386,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 388,
"end": 403,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 392,
"end": 403,
"ctxt": 0
},
"value": "FooIterator",
"optional": false
},
"arguments": null,
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 417,
"end": 421,
"ctxt": 0
},
"value": "done",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 423,
"end": 428,
"ctxt": 0
},
"value": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 451,
"end": 499,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 451,
"end": 468,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 452,
"end": 467,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 452,
"end": 458,
"ctxt": 0
},
"value": "Symbol",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 459,
"end": 467,
"ctxt": 0
},
"value": "iterator",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 451,
"end": 499,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 471,
"end": 499,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 481,
"end": 493,
"ctxt": 0
},
"argument": {
"type": "ThisExpression",
"span": {
"start": 488,
"end": 492,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}