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

835 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 61,
"end": 400,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 112,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 75,
"end": 112,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 75,
"end": 78,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 78,
"end": 112,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 80,
"end": 112,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 80,
"end": 100,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 82,
"end": 98,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 82,
"end": 87,
"ctxt": 0
},
"value": "value",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 98,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 90,
"end": 98,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 90,
"end": 96,
"ctxt": 0
},
"kind": "number"
}
}
},
"typeParams": null
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 103,
"end": 112,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 128,
"end": 157,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 128,
"end": 157,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 135,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 137,
"end": 157,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 137,
"end": 145,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 137,
"end": 143,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 114,
"end": 208,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 159,
"end": 208,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 165,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 165,
"end": 205,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 165,
"end": 200,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 165,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 166,
"end": 194,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 166,
"end": 173,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 178,
"end": 194,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 178,
"end": 188,
"ctxt": 0
},
"questionDotToken": {
"start": 181,
"end": 182,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 178,
"end": 188,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 183,
"end": 188,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 192,
"end": 194,
"ctxt": 0
},
"elements": []
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 196,
"end": 200,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 201,
"end": 204,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 219,
"end": 223,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 224,
"end": 253,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 224,
"end": 253,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 231,
"end": 253,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 233,
"end": 253,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 233,
"end": 241,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 233,
"end": 239,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 244,
"end": 253,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 210,
"end": 304,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 255,
"end": 304,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 261,
"end": 302,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 261,
"end": 301,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 261,
"end": 296,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 261,
"end": 291,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 262,
"end": 290,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 262,
"end": 269,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 274,
"end": 290,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 274,
"end": 284,
"ctxt": 0
},
"questionDotToken": {
"start": 277,
"end": 278,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 274,
"end": 284,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 274,
"end": 277,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 279,
"end": 284,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 288,
"end": 290,
"ctxt": 0
},
"elements": []
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 297,
"end": 300,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 315,
"end": 319,
"ctxt": 0
},
"value": "foo3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 320,
"end": 349,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 320,
"end": 349,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 327,
"end": 349,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 329,
"end": 349,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 329,
"end": 337,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 329,
"end": 335,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 340,
"end": 349,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 306,
"end": 400,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 351,
"end": 400,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 357,
"end": 398,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 357,
"end": 397,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 357,
"end": 392,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 357,
"end": 387,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 358,
"end": 386,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 358,
"end": 365,
"ctxt": 0
},
"value": "results",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 370,
"end": 386,
"ctxt": 0
},
"operator": "??",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 370,
"end": 380,
"ctxt": 0
},
"questionDotToken": {
"start": 373,
"end": 374,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 370,
"end": 380,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 370,
"end": 373,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 375,
"end": 380,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 384,
"end": 386,
"ctxt": 0
},
"elements": []
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 388,
"end": 392,
"ctxt": 0
},
"value": "push",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 393,
"end": 396,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}