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

402 lines
8.9 KiB
JSON

{
"type": "Script",
"span": {
"start": 45,
"end": 196,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 45,
"end": 59,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 49,
"end": 58,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 49,
"end": 54,
"ctxt": 0
},
"value": "count",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 57,
"end": 58,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 60,
"end": 73,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 64,
"end": 72,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 70,
"end": 72,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 83,
"end": 87,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 74,
"end": 113,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 90,
"end": 113,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 96,
"end": 111,
"ctxt": 0
},
"argument": {
"type": "UpdateExpression",
"span": {
"start": 103,
"end": 110,
"ctxt": 0
},
"operator": "++",
"prefix": true,
"argument": {
"type": "Identifier",
"span": {
"start": 105,
"end": 110,
"ctxt": 0
},
"value": "count",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 139,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 121,
"end": 139,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 121,
"end": 125,
"ctxt": 0
},
"value": "oobj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 128,
"end": 139,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"value": "obj",
"optional": false
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 141,
"end": 164,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 141,
"end": 163,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 152,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 144,
"end": 152,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 145,
"end": 151,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 145,
"end": 149,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 157,
"end": 163,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 157,
"end": 161,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 165,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 165,
"end": 195,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "MemberExpression",
"span": {
"start": 165,
"end": 184,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 165,
"end": 176,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 165,
"end": 169,
"ctxt": 0
},
"value": "oobj",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 169,
"end": 176,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 170,
"end": 175,
"ctxt": 0
},
"value": "obj",
"raw": "\"obj\""
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 176,
"end": 184,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 177,
"end": 183,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 177,
"end": 181,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 189,
"end": 195,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 189,
"end": 193,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
}
],
"interpreter": null
}