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

843 lines
23 KiB
JSON

{
"type": "Script",
"span": {
"start": 62,
"end": 447,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 71,
"end": 75,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 76,
"end": 105,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 76,
"end": 105,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 105,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 85,
"end": 105,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 91,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 96,
"end": 105,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 107,
"end": 137,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 107,
"end": 137,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 115,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 117,
"end": 137,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 117,
"end": 125,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 117,
"end": 123,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 62,
"end": 189,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 139,
"end": 189,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 145,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 145,
"end": 186,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 145,
"end": 181,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 145,
"end": 176,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 175,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 146,
"end": 153,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 158,
"end": 175,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 159,
"end": 174,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 159,
"end": 167,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 172,
"end": 174,
"ctxt": 0
},
"elements": []
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 177,
"end": 181,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 182,
"end": 185,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 200,
"end": 204,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 205,
"end": 234,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 205,
"end": 234,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 212,
"end": 234,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 214,
"end": 234,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 214,
"end": 222,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 214,
"end": 220,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 225,
"end": 234,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 236,
"end": 266,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 236,
"end": 266,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 244,
"end": 266,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 246,
"end": 266,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 246,
"end": 254,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 246,
"end": 252,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 257,
"end": 266,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 191,
"end": 318,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 268,
"end": 318,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 274,
"end": 316,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 274,
"end": 315,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 274,
"end": 310,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 274,
"end": 305,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 275,
"end": 304,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 275,
"end": 282,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 287,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 288,
"end": 303,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 288,
"end": 296,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 301,
"end": 303,
"ctxt": 0
},
"elements": []
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 306,
"end": 310,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 311,
"end": 314,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 329,
"end": 333,
"ctxt": 0
},
"value": "foo3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 334,
"end": 363,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 334,
"end": 363,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 341,
"end": 363,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 343,
"end": 363,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 343,
"end": 351,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 343,
"end": 349,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 354,
"end": 363,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 365,
"end": 395,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 365,
"end": 395,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 373,
"end": 395,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 375,
"end": 395,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 375,
"end": 383,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 375,
"end": 381,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 386,
"end": 395,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 320,
"end": 447,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 397,
"end": 447,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 403,
"end": 445,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 403,
"end": 444,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 403,
"end": 439,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 403,
"end": 434,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 404,
"end": 433,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 404,
"end": 411,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 416,
"end": 433,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 417,
"end": 432,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 417,
"end": 425,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 430,
"end": 432,
"ctxt": 0
},
"elements": []
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 435,
"end": 439,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 440,
"end": 443,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}