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

544 lines
13 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 286,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 16,
"end": 31,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 28,
"end": 29,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 28,
"end": 29,
"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": 38,
"end": 41,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 32,
"end": 59,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"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": 50,
"end": 53,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 66,
"end": 77,
"ctxt": 0
},
"value": "FooIterator",
"optional": false
},
"declare": false,
"span": {
"start": 60,
"end": 234,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 84,
"end": 178,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
},
"value": "next",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 84,
"end": 178,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 91,
"end": 178,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 101,
"end": 172,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 108,
"end": 171,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 122,
"end": 127,
"ctxt": 0
},
"value": "value",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 129,
"end": 136,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"arguments": null,
"typeArguments": null
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 150,
"end": 154,
"ctxt": 0
},
"value": "done",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 156,
"end": 161,
"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": 184,
"end": 232,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 184,
"end": 201,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 185,
"end": 200,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 185,
"end": 191,
"ctxt": 0
},
"value": "Symbol",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 192,
"end": 200,
"ctxt": 0
},
"value": "iterator",
"optional": false
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 184,
"end": 232,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 204,
"end": 232,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 214,
"end": 226,
"ctxt": 0
},
"argument": {
"type": "ThisExpression",
"span": {
"start": 221,
"end": 225,
"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": "VariableDeclaration",
"span": {
"start": 236,
"end": 260,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 240,
"end": 246,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 241,
"end": 246,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 248,
"end": 259,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 249,
"end": 259,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 251,
"end": 259,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 251,
"end": 257,
"ctxt": 0
},
"kind": "string"
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 261,
"end": 286,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 261,
"end": 285,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"span": {
"start": 261,
"end": 267,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NewExpression",
"span": {
"start": 270,
"end": 285,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 274,
"end": 285,
"ctxt": 0
},
"value": "FooIterator",
"optional": false
},
"arguments": null,
"typeArguments": null
}
}
}
],
"interpreter": null
}