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

531 lines
13 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 245,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 54,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 53,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 6,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 8,
"end": 53,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 17,
"end": 23,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 26,
"end": 33,
"ctxt": 0
},
"kind": "boolean"
},
{
"type": "TsTypeReference",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"value": "RegExp",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 45,
"end": 53,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 45,
"end": 53,
"ctxt": 0
},
"value": "Function",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 55,
"end": 68,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 59,
"end": 67,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 59,
"end": 62,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 67,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 69,
"end": 87,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 73,
"end": 86,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 77,
"ctxt": 0
},
"value": "cond",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 77,
"end": 86,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 79,
"end": 86,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 89,
"end": 97,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 89,
"end": 96,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "RegExpLiteral",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"pattern": "a",
"flags": ""
}
}
},
{
"type": "ForInStatement",
"span": {
"start": 98,
"end": 242,
"ctxt": 0
},
"left": {
"type": "VariableDeclaration",
"span": {
"start": 103,
"end": 108,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 112,
"end": 115,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 117,
"end": 242,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 123,
"end": 129,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 123,
"end": 128,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "IfStatement",
"span": {
"start": 134,
"end": 185,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 138,
"end": 142,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 144,
"end": 185,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 154,
"end": 161,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 158,
"end": 160,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ContinueStatement",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"label": null
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 190,
"end": 240,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 194,
"end": 198,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 200,
"end": 240,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 210,
"end": 219,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 210,
"end": 218,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 214,
"end": 218,
"ctxt": 0
},
"value": true
}
}
},
{
"type": "BreakStatement",
"span": {
"start": 228,
"end": 234,
"ctxt": 0
},
"label": null
}
]
},
"alternate": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 243,
"end": 245,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 243,
"end": 244,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"interpreter": null
}