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

639 lines
19 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 44,
"end": 472,
"ctxt": 0
},
"body": [
{
"type": "TryStatement",
"span": {
"start": 44,
"end": 248,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 48,
"end": 50,
"ctxt": 0
},
"stmts": []
},
"handler": {
"type": "CatchClause",
"span": {
"start": 51,
"end": 248,
"ctxt": 0
},
"param": {
"type": "Identifier",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 61,
"end": 248,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 67,
"end": 106,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 73,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"value": "isString",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 84,
"end": 105,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 97,
"end": 105,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 111,
"end": 169,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 115,
"end": 123,
"ctxt": 0
},
"value": "isString",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 125,
"end": 169,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 135,
"end": 151,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 135,
"end": 150,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 135,
"end": 148,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 137,
"end": 148,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 175,
"end": 246,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 179,
"end": 200,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 179,
"end": 187,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 192,
"end": 200,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 202,
"end": 246,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 212,
"end": 228,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 212,
"end": 227,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 212,
"end": 225,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 214,
"end": 225,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 250,
"end": 472,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 254,
"end": 256,
"ctxt": 0
},
"stmts": []
},
"handler": {
"type": "CatchClause",
"span": {
"start": 257,
"end": 472,
"ctxt": 0
},
"param": {
"type": "Identifier",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 267,
"end": 472,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 273,
"end": 312,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 279,
"end": 311,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 279,
"end": 287,
"ctxt": 0
},
"value": "isString",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 290,
"end": 311,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 290,
"end": 298,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 303,
"end": 311,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 318,
"end": 324,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 318,
"end": 323,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "IfStatement",
"span": {
"start": 330,
"end": 393,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 334,
"end": 342,
"ctxt": 0
},
"value": "isString",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 344,
"end": 393,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 354,
"end": 370,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 354,
"end": 369,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 354,
"end": 367,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 354,
"end": 355,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 356,
"end": 367,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "IfStatement",
"span": {
"start": 399,
"end": 470,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 403,
"end": 424,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 403,
"end": 411,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 410,
"end": 411,
"ctxt": 0
},
"value": "e",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 416,
"end": 424,
"ctxt": 0
},
"value": "string",
"raw": "'string'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 426,
"end": 470,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 436,
"end": 452,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 436,
"end": 451,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 436,
"end": 449,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 436,
"end": 437,
"ctxt": 0
},
"value": "e",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 438,
"end": 449,
"ctxt": 0
},
"value": "toUpperCase",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
}
},
"finalizer": null
}
],
"interpreter": null
}