swc/crates/swc_ecma_parser/tests/tsc/propertyAccessChain.2.json

609 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 194,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 19,
"end": 63,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 33,
"end": 62,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 33,
"end": 35,
"ctxt": 0
},
"value": "o1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 35,
"end": 62,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 37,
"end": 62,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 37,
"end": 46,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 49,
"end": 62,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 51,
"end": 60,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 52,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 54,
"end": 60,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"questionDotToken": {
"start": 66,
"end": 67,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 64,
"end": 66,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 68,
"end": 69,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 72,
"end": 123,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 86,
"end": 122,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 86,
"end": 88,
"ctxt": 0
},
"value": "o2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 122,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 90,
"end": 122,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 90,
"end": 99,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 102,
"end": 122,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 104,
"end": 120,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 105,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 107,
"end": 120,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 109,
"end": 118,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 112,
"end": 118,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 124,
"end": 132,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 124,
"end": 131,
"ctxt": 0
},
"object": {
"type": "OptionalChainingExpression",
"span": {
"start": 124,
"end": 129,
"ctxt": 0
},
"questionDotToken": {
"start": 126,
"end": 127,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 124,
"end": 129,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 124,
"end": 126,
"ctxt": 0
},
"value": "o2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 134,
"end": 185,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 148,
"end": 184,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 148,
"end": 150,
"ctxt": 0
},
"value": "o3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 150,
"end": 184,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 152,
"end": 184,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 154,
"end": 182,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 155,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 157,
"end": 182,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 157,
"end": 166,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 169,
"end": 182,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 171,
"end": 180,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 186,
"end": 194,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 186,
"end": 193,
"ctxt": 0
},
"questionDotToken": {
"start": 190,
"end": 191,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 186,
"end": 193,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 186,
"end": 190,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 186,
"end": 188,
"ctxt": 0
},
"value": "o3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
}
],
"interpreter": null
}