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

646 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 52,
"end": 263,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 52,
"end": 104,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 62,
"end": 63,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 64,
"end": 104,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 70,
"end": 102,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 70,
"end": 73,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 102,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 75,
"end": 102,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": 0.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 83,
"end": 85,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 83,
"end": 85,
"ctxt": 0
},
"value": 42.0
}
},
{
"type": "TsKeywordType",
"span": {
"start": 88,
"end": 97,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsLiteralType",
"span": {
"start": 100,
"end": 102,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 100,
"end": 102,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 106,
"end": 130,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 120,
"end": 129,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 120,
"end": 126,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 131,
"end": 150,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 145,
"end": 149,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 145,
"end": 146,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 146,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 151,
"end": 170,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 165,
"end": 169,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 171,
"end": 190,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 185,
"end": 189,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 186,
"end": 189,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 192,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 192,
"end": 214,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 192,
"end": 199,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 193,
"end": 198,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 195,
"end": 198,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 204,
"end": 214,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 204,
"end": 210,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 216,
"end": 239,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 216,
"end": 238,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 216,
"end": 223,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 217,
"end": 222,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 219,
"end": 222,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 228,
"end": 238,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 228,
"end": 234,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 235,
"end": 238,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 240,
"end": 263,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 240,
"end": 262,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 240,
"end": 247,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 241,
"end": 246,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 252,
"end": 262,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 252,
"end": 258,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 259,
"end": 262,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
}
],
"interpreter": null
}