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

1566 lines
44 KiB
JSON

{
"type": "Script",
"span": {
"start": 62,
"end": 552,
"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": 77,
"end": 100,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 77,
"end": 100,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 79,
"end": 100,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 81,
"end": 100,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 82,
"end": 91,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 91,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 93,
"end": 100,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 96,
"end": 100,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 62,
"end": 134,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 102,
"end": 134,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 108,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 108,
"end": 122,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 114,
"end": 122,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 115,
"end": 121,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 129,
"end": 131,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 145,
"end": 149,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 151,
"end": 174,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 151,
"end": 174,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 153,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 155,
"end": 174,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 156,
"end": 165,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 157,
"end": 165,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 159,
"end": 165,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 167,
"end": 174,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 170,
"end": 174,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 136,
"end": 208,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 176,
"end": 208,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 182,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 182,
"end": 196,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 188,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 189,
"end": 195,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 203,
"end": 205,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 219,
"end": 223,
"ctxt": 0
},
"value": "foo3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 225,
"end": 248,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 225,
"end": 248,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 227,
"end": 248,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 229,
"end": 248,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 230,
"end": 239,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 231,
"end": 239,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 233,
"end": 239,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 241,
"end": 248,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 244,
"end": 248,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 210,
"end": 282,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 250,
"end": 282,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 256,
"end": 270,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 256,
"end": 270,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 256,
"end": 257,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 262,
"end": 270,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 263,
"end": 269,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 275,
"end": 280,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 275,
"end": 280,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 275,
"end": 276,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 277,
"end": 279,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 293,
"end": 297,
"ctxt": 0
},
"value": "bar1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 299,
"end": 322,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 299,
"end": 322,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 301,
"end": 322,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 303,
"end": 322,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 304,
"end": 313,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 305,
"end": 313,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 307,
"end": 313,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 315,
"end": 322,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 318,
"end": 322,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 284,
"end": 372,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 324,
"end": 372,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 330,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 330,
"end": 360,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 336,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 337,
"end": 359,
"ctxt": 0
},
"expressions": [
{
"type": "CallExpression",
"span": {
"start": 337,
"end": 349,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 337,
"end": 347,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 339,
"end": 347,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
{
"type": "ParenthesisExpression",
"span": {
"start": 351,
"end": 359,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 352,
"end": 358,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 357,
"end": 358,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 365,
"end": 370,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 365,
"end": 370,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 367,
"end": 369,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 383,
"end": 387,
"ctxt": 0
},
"value": "bar2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 389,
"end": 412,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 389,
"end": 412,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 391,
"end": 412,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 393,
"end": 412,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 394,
"end": 403,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 395,
"end": 403,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 397,
"end": 403,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 405,
"end": 412,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 408,
"end": 412,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 374,
"end": 462,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 414,
"end": 462,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 420,
"end": 450,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 420,
"end": 450,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 420,
"end": 421,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 426,
"end": 450,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 427,
"end": 449,
"ctxt": 0
},
"expressions": [
{
"type": "CallExpression",
"span": {
"start": 427,
"end": 439,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 427,
"end": 437,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 427,
"end": 428,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 429,
"end": 437,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
{
"type": "ParenthesisExpression",
"span": {
"start": 441,
"end": 449,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 442,
"end": 448,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 442,
"end": 443,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 447,
"end": 448,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 455,
"end": 460,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 455,
"end": 460,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 457,
"end": 459,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 473,
"end": 477,
"ctxt": 0
},
"value": "bar3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 479,
"end": 502,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 479,
"end": 502,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 481,
"end": 502,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 483,
"end": 502,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 484,
"end": 493,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 485,
"end": 493,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 487,
"end": 493,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 495,
"end": 502,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 498,
"end": 502,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 464,
"end": 552,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 504,
"end": 552,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 510,
"end": 540,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 510,
"end": 540,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 510,
"end": 511,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 516,
"end": 540,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 517,
"end": 539,
"ctxt": 0
},
"expressions": [
{
"type": "CallExpression",
"span": {
"start": 517,
"end": 529,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 517,
"end": 527,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 517,
"end": 518,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 519,
"end": 527,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
{
"type": "ParenthesisExpression",
"span": {
"start": 531,
"end": 539,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 532,
"end": 538,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 532,
"end": 533,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 537,
"end": 538,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 545,
"end": 550,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 545,
"end": 550,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 545,
"end": 546,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 547,
"end": 549,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}