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

640 lines
19 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 45,
"end": 473,
"ctxt": 0
},
"body": [
{
"type": "TryStatement",
"span": {
"start": 45,
"end": 249,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 49,
"end": 51,
"ctxt": 0
},
"stmts": []
},
"handler": {
"type": "CatchClause",
"span": {
"start": 52,
"end": 249,
"ctxt": 0
},
"param": {
"type": "Identifier",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 62,
"end": 249,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 68,
"end": 107,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 74,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 74,
"end": 82,
"ctxt": 0
},
"value": "isString",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 85,
"end": 106,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 98,
"end": 106,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 112,
"end": 170,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 116,
"end": 124,
"ctxt": 0
},
"value": "isString",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 126,
"end": 170,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 152,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 136,
"end": 151,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 136,
"end": 149,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 138,
"end": 149,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 176,
"end": 247,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 180,
"end": 201,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 180,
"end": 188,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 193,
"end": 201,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 203,
"end": 247,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 213,
"end": 229,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 213,
"end": 228,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 213,
"end": 226,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 215,
"end": 226,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 251,
"end": 473,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 255,
"end": 257,
"ctxt": 0
},
"stmts": []
},
"handler": {
"type": "CatchClause",
"span": {
"start": 258,
"end": 473,
"ctxt": 0
},
"param": {
"type": "Identifier",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 268,
"end": 473,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 274,
"end": 313,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 280,
"end": 312,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 280,
"end": 288,
"ctxt": 0
},
"value": "isString",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 291,
"end": 312,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 291,
"end": 299,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 304,
"end": 312,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 319,
"end": 325,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 319,
"end": 324,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 319,
"end": 320,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "IfStatement",
"span": {
"start": 331,
"end": 394,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 335,
"end": 343,
"ctxt": 0
},
"value": "isString",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 345,
"end": 394,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 355,
"end": 371,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 355,
"end": 370,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 355,
"end": 368,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 355,
"end": 356,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 357,
"end": 368,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 400,
"end": 471,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 404,
"end": 425,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 404,
"end": 412,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 411,
"end": 412,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 417,
"end": 425,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 427,
"end": 471,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 437,
"end": 453,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 437,
"end": 452,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 437,
"end": 450,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 437,
"end": 438,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 439,
"end": 450,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
}
},
"finalizer": null
}
],
"interpreter": null
}