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

645 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 61,
"end": 272,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 61,
"end": 113,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 73,
"end": 113,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 79,
"end": 111,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 82,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 84,
"end": 111,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 92,
"end": 94,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 92,
"end": 94,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 97,
"end": 106,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsLiteralType",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 139,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 129,
"end": 138,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 129,
"end": 135,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 140,
"end": 159,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 154,
"end": 158,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 157,
"end": 158,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 157,
"end": 158,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 160,
"end": 179,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 174,
"end": 178,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 177,
"end": 178,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 177,
"end": 178,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 180,
"end": 199,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 194,
"end": 198,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 195,
"end": 198,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 201,
"end": 224,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 201,
"end": 223,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 201,
"end": 208,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 202,
"end": 207,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 204,
"end": 207,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 213,
"end": 223,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 220,
"end": 223,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 225,
"end": 248,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 225,
"end": 247,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 225,
"end": 232,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 226,
"end": 231,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 228,
"end": 231,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 237,
"end": 247,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 237,
"end": 243,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 244,
"end": 247,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 249,
"end": 272,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 249,
"end": 271,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 249,
"end": 256,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 250,
"end": 255,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 250,
"end": 251,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 252,
"end": 255,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 261,
"end": 271,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 261,
"end": 267,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 268,
"end": 271,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
}
],
"interpreter": null
}