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

653 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 26,
"end": 341,
"ctxt": 0
},
"body": [
{
"type": "TryStatement",
"span": {
"start": 26,
"end": 81,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 30,
"end": 51,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 36,
"end": 49,
"ctxt": 0
},
"argument": {
"type": "ArrayExpression",
"span": {
"start": 42,
"end": 48,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 52,
"end": 81,
"ctxt": 0
},
"param": {
"type": "ArrayPattern",
"span": {
"start": 59,
"end": 65,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 63,
"end": 64,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 67,
"end": 81,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 73,
"end": 79,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 73,
"end": 78,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 83,
"end": 146,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 87,
"end": 116,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 93,
"end": 114,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 99,
"end": 113,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 117,
"end": 146,
"ctxt": 0
},
"param": {
"type": "ObjectPattern",
"span": {
"start": 124,
"end": 130,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 132,
"end": 146,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 138,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 138,
"end": 143,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 148,
"end": 222,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 152,
"end": 185,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 158,
"end": 183,
"ctxt": 0
},
"argument": {
"type": "ArrayExpression",
"span": {
"start": 164,
"end": 182,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 165,
"end": 181,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 170,
"end": 173,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 178,
"end": 179,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
}
]
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 186,
"end": 222,
"ctxt": 0
},
"param": {
"type": "ArrayPattern",
"span": {
"start": 193,
"end": 206,
"ctxt": 0
},
"elements": [
{
"type": "ObjectPattern",
"span": {
"start": 194,
"end": 205,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 198,
"end": 201,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 208,
"end": 222,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 214,
"end": 220,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 214,
"end": 219,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "z",
"optional": false
}
}
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 289,
"end": 341,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 293,
"end": 296,
"ctxt": 0
},
"stmts": []
},
"handler": {
"type": "CatchClause",
"span": {
"start": 297,
"end": 341,
"ctxt": 0
},
"param": {
"type": "ArrayPattern",
"span": {
"start": 327,
"end": 335,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 337,
"end": 341,
"ctxt": 0
},
"stmts": []
}
},
"finalizer": null
}
],
"interpreter": null
}