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

783 lines
22 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 231,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 64,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 34,
"end": 63,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 34,
"end": 36,
"ctxt": 0
},
"value": "o1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 36,
"end": 63,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 38,
"end": 63,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 47,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 50,
"end": 63,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 52,
"end": 61,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 53,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 55,
"end": 61,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 65,
"end": 75,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 65,
"end": 74,
"ctxt": 0
},
"questionDotToken": {
"start": 67,
"end": 68,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 65,
"end": 74,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 65,
"end": 67,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 69,
"end": 74,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 70,
"end": 73,
"ctxt": 0
},
"value": "b",
"raw": "\"b\""
}
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 77,
"end": 128,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 91,
"end": 127,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"value": "o2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 93,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 95,
"end": 127,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 95,
"end": 104,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 107,
"end": 127,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 109,
"end": 125,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 125,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 112,
"end": 125,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 114,
"end": 123,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 115,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 117,
"end": 123,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 129,
"end": 141,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 129,
"end": 140,
"ctxt": 0
},
"object": {
"type": "OptionalChainingExpression",
"span": {
"start": 129,
"end": 138,
"ctxt": 0
},
"questionDotToken": {
"start": 131,
"end": 132,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 129,
"end": 138,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 129,
"end": 131,
"ctxt": 0
},
"value": "o2",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 133,
"end": 138,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"value": "b",
"raw": "\"b\""
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 142,
"end": 152,
"ctxt": 0
},
"object": {
"type": "OptionalChainingExpression",
"span": {
"start": 142,
"end": 147,
"ctxt": 0
},
"questionDotToken": {
"start": 144,
"end": 145,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 142,
"end": 147,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 142,
"end": 144,
"ctxt": 0
},
"value": "o2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 147,
"end": 152,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 148,
"end": 151,
"ctxt": 0
},
"value": "c",
"raw": "\"c\""
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 155,
"end": 206,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 169,
"end": 205,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 169,
"end": 171,
"ctxt": 0
},
"value": "o3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 171,
"end": 205,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 173,
"end": 205,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 175,
"end": 203,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 176,
"end": 203,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 178,
"end": 203,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 178,
"end": 187,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 190,
"end": 203,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 192,
"end": 201,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 193,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 195,
"end": 201,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 207,
"end": 218,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 207,
"end": 217,
"ctxt": 0
},
"questionDotToken": {
"start": 214,
"end": 215,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 207,
"end": 217,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 207,
"end": 214,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 207,
"end": 209,
"ctxt": 0
},
"value": "o3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 209,
"end": 214,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 210,
"end": 213,
"ctxt": 0
},
"value": "b",
"raw": "\"b\""
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 219,
"end": 231,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 219,
"end": 230,
"ctxt": 0
},
"questionDotToken": {
"start": 223,
"end": 224,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 219,
"end": 230,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 219,
"end": 223,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 219,
"end": 221,
"ctxt": 0
},
"value": "o3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"property": {
"type": "Computed",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"value": "c",
"raw": "\"c\""
}
}
}
}
}
],
"interpreter": null
}