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

840 lines
23 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 61,
"end": 446,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 70,
"end": 74,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 75,
"end": 104,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 75,
"end": 104,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 82,
"end": 104,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 84,
"end": 104,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 84,
"end": 90,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 95,
"end": 104,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 106,
"end": 136,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 106,
"end": 136,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 114,
"end": 136,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 116,
"end": 136,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 116,
"end": 124,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 116,
"end": 122,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 136,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 61,
"end": 188,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 138,
"end": 188,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 144,
"end": 186,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 144,
"end": 185,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 144,
"end": 180,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 144,
"end": 175,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 145,
"end": 174,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 145,
"end": 152,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 157,
"end": 174,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 158,
"end": 173,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 158,
"end": 166,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 171,
"end": 173,
"ctxt": 0
},
"elements": []
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 176,
"end": 180,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 181,
"end": 184,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 199,
"end": 203,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 204,
"end": 233,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 204,
"end": 233,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 211,
"end": 233,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 213,
"end": 233,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 213,
"end": 221,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 224,
"end": 233,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 235,
"end": 265,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 235,
"end": 265,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 243,
"end": 265,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 245,
"end": 265,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 245,
"end": 253,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 245,
"end": 251,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 256,
"end": 265,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 190,
"end": 317,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 267,
"end": 317,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 273,
"end": 315,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 273,
"end": 314,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 273,
"end": 309,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 273,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 274,
"end": 303,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 274,
"end": 281,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 286,
"end": 303,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 287,
"end": 302,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 287,
"end": 295,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 300,
"end": 302,
"ctxt": 0
},
"elements": []
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 305,
"end": 309,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 310,
"end": 313,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"value": "foo3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 333,
"end": 362,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 333,
"end": 362,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 340,
"end": 362,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 342,
"end": 362,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 342,
"end": 350,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 342,
"end": 348,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 353,
"end": 362,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 364,
"end": 394,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 364,
"end": 394,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 372,
"end": 394,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 374,
"end": 394,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 374,
"end": 382,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 374,
"end": 380,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 385,
"end": 394,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 319,
"end": 446,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 396,
"end": 446,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 402,
"end": 444,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 402,
"end": 443,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 402,
"end": 438,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 402,
"end": 433,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 403,
"end": 432,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 403,
"end": 410,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 415,
"end": 432,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 416,
"end": 431,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 416,
"end": 424,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 429,
"end": 431,
"ctxt": 0
},
"elements": []
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 434,
"end": 438,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 439,
"end": 442,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}