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

744 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 304,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 14,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 6,
"end": 13,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 10,
"end": 13,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 15,
"end": 29,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 21,
"end": 28,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 25,
"end": 28,
"ctxt": 0
},
"value": "b",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 30,
"end": 44,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 36,
"end": 43,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"value": "d",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 46,
"end": 72,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 55,
"end": 71,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 57,
"end": 69,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": true,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 60,
"end": 68,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 62,
"end": 68,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 73,
"end": 99,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 82,
"end": 98,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 84,
"end": 96,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": true,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 87,
"end": 95,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 89,
"end": 95,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 101,
"end": 124,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 115,
"end": 123,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 116,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 118,
"end": 123,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 126,
"end": 183,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 130,
"end": 138,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "StringLiteral",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 140,
"end": 183,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 148,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 163,
"end": 170,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 163,
"end": 169,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 164,
"end": 169,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 165,
"end": 168,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 185,
"end": 218,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 189,
"end": 197,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "StringLiteral",
"span": {
"start": 189,
"end": 192,
"ctxt": 0
},
"value": "d",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 199,
"end": 218,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 205,
"end": 207,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 220,
"end": 271,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 224,
"end": 230,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 229,
"end": 230,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 232,
"end": 271,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 238,
"end": 240,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 253,
"end": 258,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 253,
"end": 257,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 253,
"end": 254,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 254,
"end": 257,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 273,
"end": 304,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 277,
"end": 283,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "d",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 285,
"end": 304,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 291,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
]
},
"alternate": null
}
],
"interpreter": null
}