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

803 lines
22 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 230,
"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": 74,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 64,
"end": 73,
"ctxt": 0
},
"questionDotToken": {
"start": 66,
"end": 67,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 64,
"end": 73,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 64,
"end": 66,
"ctxt": 0
},
"value": "o1",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 68,
"end": 73,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 69,
"end": 72,
"ctxt": 0
},
"value": "b",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 76,
"end": 127,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 90,
"end": 126,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 90,
"end": 92,
"ctxt": 0
},
"value": "o2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 92,
"end": 126,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 94,
"end": 126,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 94,
"end": 103,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 106,
"end": 126,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 108,
"end": 124,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 109,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 109,
"end": 124,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 111,
"end": 124,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 113,
"end": 122,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 114,
"end": 122,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 116,
"end": 122,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
}
]
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 128,
"end": 140,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 128,
"end": 139,
"ctxt": 0
},
"object": {
"type": "OptionalChainingExpression",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"questionDotToken": {
"start": 130,
"end": 131,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 128,
"end": 130,
"ctxt": 0
},
"value": "o2",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"value": "b",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 141,
"end": 152,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 151,
"ctxt": 0
},
"object": {
"type": "OptionalChainingExpression",
"span": {
"start": 141,
"end": 146,
"ctxt": 0
},
"questionDotToken": {
"start": 143,
"end": 144,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 146,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 141,
"end": 143,
"ctxt": 0
},
"value": "o2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 145,
"end": 146,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 146,
"end": 151,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 147,
"end": 150,
"ctxt": 0
},
"value": "c",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 154,
"end": 205,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 168,
"end": 204,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 168,
"end": 170,
"ctxt": 0
},
"value": "o3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 170,
"end": 204,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 172,
"end": 204,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 174,
"end": 202,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 175,
"end": 202,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 177,
"end": 202,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 177,
"end": 186,
"ctxt": 0
},
"kind": "undefined"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 189,
"end": 202,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 191,
"end": 200,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 192,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 194,
"end": 200,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 206,
"end": 217,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 206,
"end": 216,
"ctxt": 0
},
"questionDotToken": {
"start": 213,
"end": 214,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 206,
"end": 216,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 206,
"end": 213,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 206,
"end": 208,
"ctxt": 0
},
"value": "o3",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 208,
"end": 213,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 209,
"end": 212,
"ctxt": 0
},
"value": "b",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 218,
"end": 230,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 218,
"end": 229,
"ctxt": 0
},
"questionDotToken": {
"start": 222,
"end": 223,
"ctxt": 0
},
"expr": {
"type": "MemberExpression",
"span": {
"start": 218,
"end": 229,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 218,
"end": 222,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 218,
"end": 220,
"ctxt": 0
},
"value": "o3",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"property": {
"type": "Computed",
"span": {
"start": 224,
"end": 229,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 225,
"end": 228,
"ctxt": 0
},
"value": "c",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
}
}
],
"interpreter": null
}