swc/crates/swc_ecma_parser/tests/tsc/ES5For-of37.json

523 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 86,
"end": 429,
"ctxt": 0
},
"body": [
{
"type": "ForOfStatement",
"span": {
"start": 86,
"end": 429,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 91,
"end": 98,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 102,
"end": 117,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": 4.0
}
}
]
},
"body": {
"type": "BlockStatement",
"span": {
"start": 119,
"end": 429,
"ctxt": 0
},
"stmts": [
{
"type": "TryStatement",
"span": {
"start": 125,
"end": 427,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 129,
"end": 367,
"ctxt": 0
},
"stmts": [
{
"type": "ForOfStatement",
"span": {
"start": 218,
"end": 337,
"ctxt": 0
},
"await": null,
"left": {
"type": "VariableDeclaration",
"span": {
"start": 223,
"end": 230,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 229,
"end": 230,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 229,
"end": 230,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "ArrayExpression",
"span": {
"start": 234,
"end": 243,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": 3.0
}
}
]
},
"body": {
"type": "BlockStatement",
"span": {
"start": 245,
"end": 337,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 259,
"end": 327,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 263,
"end": 270,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "i",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": 2.0
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 272,
"end": 327,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 290,
"end": 313,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 296,
"end": 312,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 300,
"end": 305,
"ctxt": 0
},
"value": "Error",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 306,
"end": 311,
"ctxt": 0
},
"value": "ERR",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 346,
"end": 361,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 346,
"end": 360,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 346,
"end": 357,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 346,
"end": 353,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 354,
"end": 357,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "i",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 368,
"end": 427,
"ctxt": 0
},
"param": {
"type": "Identifier",
"span": {
"start": 375,
"end": 378,
"ctxt": 0
},
"value": "err",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 380,
"end": 427,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 390,
"end": 421,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 390,
"end": 420,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 390,
"end": 401,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 390,
"end": 397,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 402,
"end": 411,
"ctxt": 0
},
"value": "E %s %s",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 413,
"end": 414,
"ctxt": 0
},
"value": "i",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 416,
"end": 419,
"ctxt": 0
},
"value": "err",
"optional": false
}
}
],
"typeArguments": null
}
}
]
}
},
"finalizer": null
}
]
}
}
],
"interpreter": null
}