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

819 lines
22 KiB
JSON

{
"type": "Script",
"span": {
"start": 62,
"end": 441,
"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": 187,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 139,
"end": 187,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 145,
"end": 185,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 145,
"end": 184,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 145,
"end": 179,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 145,
"end": 174,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 173,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 146,
"end": 153,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"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": 175,
"end": 179,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 183,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 198,
"end": 202,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 203,
"end": 232,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 203,
"end": 232,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 210,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 212,
"end": 232,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 212,
"end": 220,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 223,
"end": 232,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 234,
"end": 264,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 234,
"end": 264,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 242,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 244,
"end": 264,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 244,
"end": 252,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 244,
"end": 250,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 255,
"end": 264,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 189,
"end": 314,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 266,
"end": 314,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 272,
"end": 312,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 272,
"end": 311,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 272,
"end": 306,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 272,
"end": 301,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 273,
"end": 300,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 273,
"end": 280,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "AssignmentExpression",
"span": {
"start": 285,
"end": 300,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 285,
"end": 293,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 298,
"end": 300,
"ctxt": 0
},
"elements": []
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 302,
"end": 306,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 307,
"end": 310,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 325,
"end": 329,
"ctxt": 0
},
"value": "foo3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 330,
"end": 359,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 330,
"end": 359,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 337,
"end": 359,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 339,
"end": 359,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 339,
"end": 347,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 339,
"end": 345,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 350,
"end": 359,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 361,
"end": 391,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 361,
"end": 391,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 369,
"end": 391,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 371,
"end": 391,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 371,
"end": 379,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 371,
"end": 377,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 382,
"end": 391,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 316,
"end": 441,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 393,
"end": 441,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 399,
"end": 439,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 399,
"end": 438,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 399,
"end": 433,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 399,
"end": 428,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 400,
"end": 427,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 400,
"end": 407,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "AssignmentExpression",
"span": {
"start": 412,
"end": 427,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 412,
"end": 420,
"ctxt": 0
},
"value": "results1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 425,
"end": 427,
"ctxt": 0
},
"elements": []
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 429,
"end": 433,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 434,
"end": 437,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}