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

647 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 25,
"end": 340,
"ctxt": 0
},
"body": [
{
"type": "TryStatement",
"span": {
"start": 25,
"end": 80,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 29,
"end": 50,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 35,
"end": 48,
"ctxt": 0
},
"argument": {
"type": "ArrayExpression",
"span": {
"start": 41,
"end": 47,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 45,
"end": 46,
"ctxt": 0
},
"value": 1.0
}
}
]
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 51,
"end": 80,
"ctxt": 0
},
"param": {
"type": "ArrayPattern",
"span": {
"start": 58,
"end": 64,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 62,
"end": 63,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 66,
"end": 80,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 72,
"end": 78,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 72,
"end": 77,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 82,
"end": 145,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 86,
"end": 115,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 92,
"end": 113,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 98,
"end": 112,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 100,
"end": 101,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": 0.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": 1.0
}
}
]
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 116,
"end": 145,
"ctxt": 0
},
"param": {
"type": "ObjectPattern",
"span": {
"start": 123,
"end": 129,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 131,
"end": 145,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 137,
"end": 143,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 137,
"end": 142,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 141,
"end": 142,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 147,
"end": 221,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 151,
"end": 184,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 157,
"end": 182,
"ctxt": 0
},
"argument": {
"type": "ArrayExpression",
"span": {
"start": 163,
"end": 181,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 164,
"end": 180,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": 0.0
}
}
]
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 174,
"end": 175,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 177,
"end": 178,
"ctxt": 0
},
"value": 1.0
}
}
]
}
}
]
}
}
]
},
"handler": {
"type": "CatchClause",
"span": {
"start": 185,
"end": 221,
"ctxt": 0
},
"param": {
"type": "ArrayPattern",
"span": {
"start": 192,
"end": 205,
"ctxt": 0
},
"elements": [
{
"type": "ObjectPattern",
"span": {
"start": 193,
"end": 204,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 197,
"end": 200,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "AssignmentPatternProperty",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 207,
"end": 221,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 213,
"end": 218,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "y",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"value": "z",
"optional": false
}
}
}
]
}
},
"finalizer": null
},
{
"type": "TryStatement",
"span": {
"start": 288,
"end": 340,
"ctxt": 0
},
"block": {
"type": "BlockStatement",
"span": {
"start": 292,
"end": 295,
"ctxt": 0
},
"stmts": []
},
"handler": {
"type": "CatchClause",
"span": {
"start": 296,
"end": 340,
"ctxt": 0
},
"param": {
"type": "ArrayPattern",
"span": {
"start": 326,
"end": 334,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 332,
"end": 333,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 336,
"end": 340,
"ctxt": 0
},
"stmts": []
}
},
"finalizer": null
}
],
"interpreter": null
}