swc/crates/swc_ecma_parser/tests/tsc/controlFlowStringIndex.json
2022-02-04 17:08:38 +09:00

436 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 17,
"end": 269,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 17,
"end": 91,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 26,
"end": 90,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 32,
"end": 53,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 32,
"end": 37,
"ctxt": 0
},
"value": "other",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 39,
"end": 52,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 52,
"ctxt": 0
},
"kind": "null"
}
]
}
},
"typeParams": null
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 59,
"end": 72,
"ctxt": 0
},
"value": "index",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 64,
"end": 72,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 66,
"end": 72,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 88,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 75,
"end": 88,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
},
"kind": "null"
}
]
}
},
"readonly": false,
"static": false,
"span": {
"start": 58,
"end": 88,
"ctxt": 0
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 92,
"end": 115,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 106,
"end": 114,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 106,
"end": 111,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 116,
"end": 269,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 120,
"end": 138,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "MemberExpression",
"span": {
"start": 120,
"end": 129,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 120,
"end": 125,
"ctxt": 0
},
"value": "value",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 134,
"end": 138,
"ctxt": 0
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 140,
"end": 269,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 171,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 146,
"end": 171,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 146,
"end": 169,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 146,
"end": 155,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 146,
"end": 151,
"ctxt": 0
},
"value": "value",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 152,
"end": 155,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 156,
"end": 169,
"ctxt": 0
},
"value": "toExponential",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 176,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 176,
"end": 187,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 176,
"end": 181,
"ctxt": 0
},
"value": "value",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 182,
"end": 187,
"ctxt": 0
},
"value": "other",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 225,
"end": 234,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 225,
"end": 234,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"value": "value",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 231,
"end": 234,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}