swc/crates/swc_ecma_parser/tests/tsc/controlFlowIteration.json
2022-03-22 07:54:08 +00:00

397 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 28,
"end": 318,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 28,
"end": 46,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 32,
"end": 45,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 36,
"ctxt": 0
},
"value": "cond",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 45,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 57,
"end": 59,
"ctxt": 0
},
"value": "ff",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 48,
"end": 318,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 62,
"end": 318,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 68,
"end": 94,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 72,
"end": 93,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 93,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 75,
"end": 93,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "WhileStatement",
"span": {
"start": 99,
"end": 316,
"ctxt": 0
},
"test": {
"type": "BooleanLiteral",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"value": true
},
"body": {
"type": "BlockStatement",
"span": {
"start": 112,
"end": 316,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 122,
"end": 310,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"value": "cond",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 132,
"end": 163,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 150,
"end": 152,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 177,
"end": 310,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 191,
"end": 239,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "x",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 198,
"end": 239,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 216,
"end": 225,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 216,
"end": 224,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 218,
"end": 224,
"ctxt": 0
},
"value": "length",
"optional": false
}
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 252,
"end": 300,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 256,
"end": 257,
"ctxt": 0
},
"value": "x",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 259,
"end": 300,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 277,
"end": 286,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 277,
"end": 285,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 279,
"end": 285,
"ctxt": 0
},
"value": "length",
"optional": false
}
}
}
]
},
"alternate": null
}
]
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}