swc/crates/swc_ecma_parser/tests/tsc/controlFlowForInStatement.json
2022-04-05 12:46:35 +00:00

531 lines
13 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 244,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 53,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 5,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 7,
"end": 52,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 7,
"end": 13,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 16,
"end": 22,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 25,
"end": 32,
"ctxt": 0
},
"kind": "boolean"
},
{
"type": "TsTypeReference",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"value": "RegExp",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 44,
"end": 52,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 44,
"end": 52,
"ctxt": 0
},
"value": "Function",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 54,
"end": 67,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 58,
"end": 66,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 58,
"end": 61,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 61,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 68,
"end": 86,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 72,
"end": 85,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 76,
"ctxt": 0
},
"value": "cond",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 78,
"end": 85,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 88,
"end": 96,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 88,
"end": 95,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "RegExpLiteral",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"pattern": "a",
"flags": ""
}
}
},
{
"type": "ForInStatement",
"span": {
"start": 97,
"end": 241,
"ctxt": 0
},
"left": {
"type": "VariableDeclaration",
"span": {
"start": 102,
"end": 107,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 111,
"end": 114,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 116,
"end": 241,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 122,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 122,
"end": 127,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "IfStatement",
"span": {
"start": 133,
"end": 184,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 143,
"end": 184,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 153,
"end": 160,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 157,
"end": 159,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ContinueStatement",
"span": {
"start": 169,
"end": 178,
"ctxt": 0
},
"label": null
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 189,
"end": 239,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 193,
"end": 197,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 199,
"end": 239,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 209,
"end": 218,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 209,
"end": 217,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 213,
"end": 217,
"ctxt": 0
},
"value": true
}
}
},
{
"type": "BreakStatement",
"span": {
"start": 227,
"end": 233,
"ctxt": 0
},
"label": null
}
]
},
"alternate": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 242,
"end": 244,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"interpreter": null
}