swc/crates/swc_ecma_parser/tests/tsc/ES5for-of32.json

360 lines
9.1 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 17,
"end": 150,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 17,
"end": 37,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 21,
"end": 36,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 21,
"end": 26,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 29,
"end": 36,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 34,
"end": 35,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 38,
"end": 50,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 42,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"value": "sum",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"definite": false
}
]
},
{
"type": "ForOfStatement",
"span": {
"start": 52,
"end": 150,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 57,
"end": 64,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 61,
"end": 64,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 61,
"end": 64,
"ctxt": 0
},
"value": "num",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 68,
"end": 73,
"ctxt": 0
},
"value": "array",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 75,
"end": 150,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 81,
"end": 127,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 85,
"end": 94,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 85,
"end": 88,
"ctxt": 0
},
"value": "sum",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 96,
"end": 127,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 106,
"end": 121,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 106,
"end": 121,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 106,
"end": 111,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 114,
"end": 121,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": 5.0,
"raw": "5"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"value": 6.0,
"raw": "6"
}
}
]
}
}
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 137,
"end": 148,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 137,
"end": 147,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "Identifier",
"span": {
"start": 137,
"end": 140,
"ctxt": 0
},
"value": "sum",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 144,
"end": 147,
"ctxt": 0
},
"value": "num",
"optional": false
}
}
}
]
}
}
],
"interpreter": null
}