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

752 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 385,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 22,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 7,
"end": 21,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 7,
"end": 15,
"ctxt": 0
},
"value": "keywordA",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 18,
"end": 21,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 23,
"end": 44,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 29,
"end": 43,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 29,
"end": 37,
"ctxt": 0
},
"value": "keywordB",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"value": "b",
"raw": "'b'"
},
"definite": false
}
]
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 46,
"end": 78,
"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": 77,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 57,
"end": 75,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 58,
"end": 66,
"ctxt": 0
},
"value": "keywordA",
"optional": false
},
"computed": true,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 79,
"end": 111,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 88,
"end": 110,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 90,
"end": 108,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 91,
"end": 99,
"ctxt": 0
},
"value": "keywordB",
"optional": false
},
"computed": true,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 100,
"end": 108,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 102,
"end": 108,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 113,
"end": 136,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 127,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 135,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 130,
"end": 135,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 138,
"end": 181,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 142,
"end": 150,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "StringLiteral",
"span": {
"start": 142,
"end": 145,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
},
"right": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 152,
"end": 181,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 158,
"end": 160,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 183,
"end": 236,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 187,
"end": 200,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "Identifier",
"span": {
"start": 187,
"end": 195,
"ctxt": 0
},
"value": "keywordA",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 202,
"end": 236,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 208,
"end": 210,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
]
},
"alternate": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 238,
"end": 264,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 242,
"end": 263,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 242,
"end": 249,
"ctxt": 0
},
"value": "stringB",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 249,
"end": 257,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 251,
"end": 257,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 260,
"end": 263,
"ctxt": 0
},
"value": "b",
"raw": "'b'"
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 266,
"end": 322,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 270,
"end": 291,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 270,
"end": 286,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 271,
"end": 285,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 271,
"end": 278,
"ctxt": 0
},
"value": "stringB",
"optional": false
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"value": "b",
"raw": "'b'"
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 293,
"end": 322,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 299,
"end": 301,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 324,
"end": 385,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 328,
"end": 357,
"ctxt": 0
},
"operator": "in",
"left": {
"type": "ParenthesisExpression",
"span": {
"start": 328,
"end": 352,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 329,
"end": 351,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 329,
"end": 336,
"ctxt": 0
},
"value": "stringB",
"optional": false
},
"typeAnnotation": {
"type": "TsParenthesizedType",
"span": {
"start": 340,
"end": 351,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 341,
"end": 350,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 341,
"end": 344,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 341,
"end": 344,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
},
{
"type": "TsLiteralType",
"span": {
"start": 347,
"end": 350,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 347,
"end": 350,
"ctxt": 0
},
"value": "b",
"raw": "'b'"
}
}
]
}
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 356,
"end": 357,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 359,
"end": 385,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 365,
"end": 367,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "c",
"optional": false
}
}
]
},
"alternate": null
}
],
"interpreter": null
}