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

405 lines
9.0 KiB
JSON

{
"type": "Script",
"span": {
"start": 36,
"end": 187,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 36,
"end": 50,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 40,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 40,
"end": 45,
"ctxt": 0
},
"value": "count",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"value": 0.0
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 64,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 63,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 58,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 61,
"end": 63,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 74,
"end": 78,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 65,
"end": 104,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 81,
"end": 104,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 87,
"end": 102,
"ctxt": 0
},
"argument": {
"type": "UpdateExpression",
"span": {
"start": 94,
"end": 101,
"ctxt": 0
},
"operator": "++",
"prefix": true,
"argument": {
"type": "Identifier",
"span": {
"start": 96,
"end": 101,
"ctxt": 0
},
"value": "count",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 106,
"end": 130,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 112,
"end": 130,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 116,
"ctxt": 0
},
"value": "oobj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 119,
"end": 130,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"value": "obj",
"optional": false
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 132,
"end": 155,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 132,
"end": 154,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "MemberExpression",
"span": {
"start": 132,
"end": 143,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 132,
"end": 135,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 135,
"end": 143,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 136,
"end": 142,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 136,
"end": 140,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 148,
"end": 154,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 148,
"end": 152,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 156,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 156,
"end": 186,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "MemberExpression",
"span": {
"start": 156,
"end": 175,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 156,
"end": 167,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 156,
"end": 160,
"ctxt": 0
},
"value": "oobj",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 160,
"end": 167,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 161,
"end": 166,
"ctxt": 0
},
"value": "obj",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 167,
"end": 175,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 168,
"end": 172,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 180,
"end": 184,
"ctxt": 0
},
"value": "incr",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
}
],
"interpreter": null
}