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

645 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 439,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 18,
"end": 91,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 32,
"end": 90,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 38,
"ctxt": 0
},
"value": "config",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 38,
"end": 90,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 40,
"end": 90,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 47,
"end": 58,
"ctxt": 0
},
"value": "key",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 50,
"end": 58,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 52,
"end": 58,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 59,
"end": 87,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 61,
"end": 87,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 61,
"end": 68,
"ctxt": 0
},
"kind": "boolean"
},
{
"type": "TsTypeLiteral",
"span": {
"start": 71,
"end": 87,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 73,
"end": 85,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 73,
"end": 77,
"ctxt": 0
},
"value": "prop",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 77,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 79,
"end": 85,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
]
}
},
"readonly": false,
"static": false,
"span": {
"start": 46,
"end": 88,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 93,
"end": 267,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 97,
"end": 133,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "UnaryExpression",
"span": {
"start": 97,
"end": 119,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "MemberExpression",
"span": {
"start": 104,
"end": 119,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"value": "config",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 110,
"end": 119,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 111,
"end": 118,
"ctxt": 0
},
"value": "works",
"raw": "'works'"
}
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 124,
"end": 133,
"ctxt": 0
},
"value": "boolean",
"raw": "'boolean'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 135,
"end": 267,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 141,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 141,
"end": 167,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 158,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 153,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 141,
"end": 147,
"ctxt": 0
},
"value": "config",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 148,
"end": 153,
"ctxt": 0
},
"value": "works",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 154,
"end": 158,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 161,
"end": 167,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 179,
"end": 209,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 179,
"end": 208,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 179,
"end": 199,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 179,
"end": 194,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 179,
"end": 185,
"ctxt": 0
},
"value": "config",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 185,
"end": 194,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 186,
"end": 193,
"ctxt": 0
},
"value": "works",
"raw": "'works'"
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 195,
"end": 199,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 202,
"end": 208,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 268,
"end": 439,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 272,
"end": 305,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "UnaryExpression",
"span": {
"start": 272,
"end": 291,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "MemberExpression",
"span": {
"start": 279,
"end": 291,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 279,
"end": 285,
"ctxt": 0
},
"value": "config",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 286,
"end": 291,
"ctxt": 0
},
"value": "works",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 296,
"end": 305,
"ctxt": 0
},
"value": "boolean",
"raw": "'boolean'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 307,
"end": 439,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 313,
"end": 343,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 313,
"end": 342,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 313,
"end": 333,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 313,
"end": 328,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 313,
"end": 319,
"ctxt": 0
},
"value": "config",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 319,
"end": 328,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 320,
"end": 327,
"ctxt": 0
},
"value": "works",
"raw": "'works'"
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 329,
"end": 333,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 336,
"end": 342,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 404,
"end": 431,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 404,
"end": 430,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 404,
"end": 421,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 404,
"end": 416,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 404,
"end": 410,
"ctxt": 0
},
"value": "config",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 411,
"end": 416,
"ctxt": 0
},
"value": "works",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 417,
"end": 421,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 424,
"end": 430,
"ctxt": 0
},
"value": "test",
"raw": "'test'"
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}