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

834 lines
22 KiB
JSON

{
"type": "Script",
"span": {
"start": 15,
"end": 500,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 24,
"end": 27,
"ctxt": 0
},
"value": "fun",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 28,
"end": 51,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 28,
"end": 51,
"ctxt": 0
},
"rest": {
"start": 28,
"end": 31,
"ctxt": 0
},
"argument": {
"type": "ArrayPattern",
"span": {
"start": 31,
"end": 37,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 35,
"end": 36,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 39,
"end": 51,
"ctxt": 0
},
"elemType": {
"type": "TsTupleType",
"span": {
"start": 39,
"end": 49,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsTypeReference",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"typeParams": null
}
},
{
"type": "TsTupleElement",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsTypeReference",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"typeParams": null
}
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 15,
"end": 56,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 53,
"end": 56,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 57,
"end": 89,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 57,
"end": 88,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"value": "fun",
"optional": false
},
"arguments": [
{
"spread": {
"start": 61,
"end": 64,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 64,
"end": 87,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 68,
"end": 87,
"ctxt": 0
},
"value": "FooIteratorIterator",
"optional": false
},
"arguments": null,
"typeArguments": null
}
}
],
"typeArguments": null
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 96,
"end": 99,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 90,
"end": 105,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"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": 112,
"end": 115,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 106,
"end": 133,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"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": 124,
"end": 127,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 140,
"end": 151,
"ctxt": 0
},
"value": "FooIterator",
"optional": false
},
"declare": false,
"span": {
"start": 134,
"end": 308,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 158,
"end": 252,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 158,
"end": 162,
"ctxt": 0
},
"value": "next",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 158,
"end": 252,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 165,
"end": 252,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 175,
"end": 246,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 182,
"end": 245,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 196,
"end": 201,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 203,
"end": 210,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 207,
"end": 210,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"arguments": null,
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 224,
"end": 228,
"ctxt": 0
},
"value": "done",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 230,
"end": 235,
"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": 258,
"end": 306,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 258,
"end": 275,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 259,
"end": 274,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 259,
"end": 265,
"ctxt": 0
},
"value": "Symbol",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 266,
"end": 274,
"ctxt": 0
},
"value": "iterator",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 258,
"end": 306,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 278,
"end": 306,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 288,
"end": 300,
"ctxt": 0
},
"argument": {
"type": "ThisExpression",
"span": {
"start": 295,
"end": 299,
"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": 316,
"end": 335,
"ctxt": 0
},
"value": "FooIteratorIterator",
"optional": false
},
"declare": false,
"span": {
"start": 310,
"end": 500,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 342,
"end": 444,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 342,
"end": 346,
"ctxt": 0
},
"value": "next",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 342,
"end": 444,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 349,
"end": 444,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 359,
"end": 438,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 366,
"end": 437,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 380,
"end": 385,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 387,
"end": 402,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 391,
"end": 402,
"ctxt": 0
},
"value": "FooIterator",
"optional": false
},
"arguments": null,
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 416,
"end": 420,
"ctxt": 0
},
"value": "done",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 422,
"end": 427,
"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": 450,
"end": 498,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 450,
"end": 467,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 451,
"end": 466,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
},
"value": "Symbol",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 458,
"end": 466,
"ctxt": 0
},
"value": "iterator",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 450,
"end": 498,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 470,
"end": 498,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 480,
"end": 492,
"ctxt": 0
},
"argument": {
"type": "ThisExpression",
"span": {
"start": 487,
"end": 491,
"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
}