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

361 lines
9.3 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 179,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 19,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 18,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 8,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 8,
"end": 18,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 10,
"end": 18,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 10,
"end": 16,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 62,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 24,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 24,
"end": 25,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 25,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 27,
"end": 61,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 27,
"end": 33,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 52,
"ctxt": 0
},
"kind": "boolean"
},
{
"type": "TsTypeReference",
"span": {
"start": 55,
"end": 61,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 55,
"end": 61,
"ctxt": 0
},
"value": "RegExp",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "a",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 64,
"end": 179,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 77,
"end": 179,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 83,
"end": 92,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 83,
"end": 91,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 87,
"end": 91,
"ctxt": 0
},
"value": true
}
}
},
{
"type": "ForOfStatement",
"span": {
"start": 97,
"end": 150,
"ctxt": 0
},
"await": null,
"left": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 107,
"end": 110,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 112,
"end": 150,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 122,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 122,
"end": 143,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 126,
"end": 143,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 126,
"end": 141,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 128,
"end": 141,
"ctxt": 0
},
"value": "toExponential",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 155,
"end": 157,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}