swc/crates/swc_ecma_parser/tests/tsc/logicalAssignment5.json
2022-02-04 17:08:38 +09:00

1560 lines
44 KiB
JSON

{
"type": "Script",
"span": {
"start": 61,
"end": 551,
"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": 76,
"end": 99,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 76,
"end": 99,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 78,
"end": 99,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 80,
"end": 99,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 81,
"end": 90,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 82,
"end": 90,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 84,
"end": 90,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 92,
"end": 99,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 95,
"end": 99,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 61,
"end": 133,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 101,
"end": 133,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 107,
"end": 121,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 107,
"end": 121,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 113,
"end": 121,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 114,
"end": 120,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 126,
"end": 131,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 126,
"end": 131,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 128,
"end": 130,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 144,
"end": 148,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 150,
"end": 173,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 150,
"end": 173,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 152,
"end": 173,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 154,
"end": 173,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 155,
"end": 164,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 156,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 158,
"end": 164,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 173,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 169,
"end": 173,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 135,
"end": 207,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 175,
"end": 207,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 181,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 181,
"end": 195,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 187,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 188,
"end": 194,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 200,
"end": 205,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 200,
"end": 205,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 202,
"end": 204,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 218,
"end": 222,
"ctxt": 0
},
"value": "foo3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 224,
"end": 247,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 224,
"end": 247,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 226,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 228,
"end": 247,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 229,
"end": 238,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 230,
"end": 238,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 232,
"end": 238,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 240,
"end": 247,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 243,
"end": 247,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 209,
"end": 281,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 249,
"end": 281,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 255,
"end": 269,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 255,
"end": 269,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 261,
"end": 269,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 262,
"end": 268,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 274,
"end": 279,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 274,
"end": 279,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 274,
"end": 275,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 276,
"end": 278,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
},
"value": "bar1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 298,
"end": 321,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 298,
"end": 321,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 300,
"end": 321,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 302,
"end": 321,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 303,
"end": 312,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 304,
"end": 312,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 306,
"end": 312,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 314,
"end": 321,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 317,
"end": 321,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 283,
"end": 371,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 323,
"end": 371,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 329,
"end": 359,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 329,
"end": 359,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 335,
"end": 359,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 336,
"end": 358,
"ctxt": 0
},
"expressions": [
{
"type": "CallExpression",
"span": {
"start": 336,
"end": 348,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 336,
"end": 346,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 336,
"end": 337,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 338,
"end": 346,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
{
"type": "ParenthesisExpression",
"span": {
"start": 350,
"end": 358,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 351,
"end": 357,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 356,
"end": 357,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 364,
"end": 369,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 364,
"end": 369,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 364,
"end": 365,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 366,
"end": 368,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 382,
"end": 386,
"ctxt": 0
},
"value": "bar2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 388,
"end": 411,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 388,
"end": 411,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 390,
"end": 411,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 392,
"end": 411,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 393,
"end": 402,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 394,
"end": 402,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 396,
"end": 402,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 404,
"end": 411,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 407,
"end": 411,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 373,
"end": 461,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 413,
"end": 461,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 419,
"end": 449,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 419,
"end": 449,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 419,
"end": 420,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 425,
"end": 449,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 426,
"end": 448,
"ctxt": 0
},
"expressions": [
{
"type": "CallExpression",
"span": {
"start": 426,
"end": 438,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 426,
"end": 436,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 426,
"end": 427,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 428,
"end": 436,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
{
"type": "ParenthesisExpression",
"span": {
"start": 440,
"end": 448,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 441,
"end": 447,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 441,
"end": 442,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 446,
"end": 447,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 454,
"end": 459,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 454,
"end": 459,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 454,
"end": 455,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 456,
"end": 458,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 472,
"end": 476,
"ctxt": 0
},
"value": "bar3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 478,
"end": 501,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 478,
"end": 501,
"ctxt": 0
},
"value": "f",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 480,
"end": 501,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 482,
"end": 501,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 483,
"end": 492,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 484,
"end": 492,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 486,
"end": 492,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 494,
"end": 501,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 497,
"end": 501,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 463,
"end": 551,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 503,
"end": 551,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 509,
"end": 539,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 509,
"end": 539,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 509,
"end": 510,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 515,
"end": 539,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 516,
"end": 538,
"ctxt": 0
},
"expressions": [
{
"type": "CallExpression",
"span": {
"start": 516,
"end": 528,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 516,
"end": 526,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 516,
"end": 517,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 518,
"end": 526,
"ctxt": 0
},
"value": "toString",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
{
"type": "ParenthesisExpression",
"span": {
"start": 530,
"end": 538,
"ctxt": 0
},
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 531,
"end": 537,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 531,
"end": 532,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 536,
"end": 537,
"ctxt": 0
},
"value": "a",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 544,
"end": 549,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 544,
"end": 549,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 544,
"end": 545,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 546,
"end": 548,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}