swc/crates/swc_ecma_parser/tests/tsc/logicalAssignment3.json
2022-04-05 12:46:35 +00:00

645 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 60,
"end": 271,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 60,
"end": 112,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 72,
"end": 112,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 78,
"end": 110,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 81,
"end": 110,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 83,
"end": 110,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
},
{
"type": "TsKeywordType",
"span": {
"start": 96,
"end": 105,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsLiteralType",
"span": {
"start": 108,
"end": 110,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 108,
"end": 110,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 114,
"end": 138,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 128,
"end": 134,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 139,
"end": 158,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 153,
"end": 157,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 154,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 156,
"end": 157,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 159,
"end": 178,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 173,
"end": 177,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 173,
"end": 174,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 174,
"end": 177,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 179,
"end": 198,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 193,
"end": 197,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 200,
"end": 223,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 200,
"end": 222,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 200,
"end": 207,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 203,
"end": 206,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 212,
"end": 222,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 219,
"end": 222,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 224,
"end": 247,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 224,
"end": 246,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 224,
"end": 231,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 236,
"end": 246,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 236,
"end": 242,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 248,
"end": 271,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 248,
"end": 270,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 248,
"end": 255,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 249,
"end": 254,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 251,
"end": 254,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 260,
"end": 270,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 267,
"end": 270,
"ctxt": 0
},
"value": "baz",
"optional": false
}
}
}
}
],
"interpreter": null
}