mirror of
https://github.com/swc-project/swc.git
synced 2024-12-01 01:13:56 +03:00
566 lines
18 KiB
JSON
566 lines
18 KiB
JSON
{
|
|
"type": "Script",
|
|
"span": {
|
|
"start": 1,
|
|
"end": 587,
|
|
"ctxt": 0
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 18,
|
|
"end": 28,
|
|
"ctxt": 0
|
|
},
|
|
"value": "isFooError",
|
|
"optional": false
|
|
},
|
|
"declare": true,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 29,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 29,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 30,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 32,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "any"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 1,
|
|
"end": 73,
|
|
"ctxt": 0
|
|
},
|
|
"body": null,
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 36,
|
|
"end": 72,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypePredicate",
|
|
"span": {
|
|
"start": 38,
|
|
"end": 72,
|
|
"ctxt": 0
|
|
},
|
|
"asserts": false,
|
|
"paramName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 38,
|
|
"end": 39,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 43,
|
|
"end": 72,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 43,
|
|
"end": 72,
|
|
"ctxt": 0
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 45,
|
|
"end": 57,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 45,
|
|
"end": 49,
|
|
"ctxt": 0
|
|
},
|
|
"value": "type",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"init": null,
|
|
"params": [],
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 49,
|
|
"end": 56,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 51,
|
|
"end": 56,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 51,
|
|
"end": 56,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"raw": "'foo'"
|
|
}
|
|
}
|
|
},
|
|
"typeParams": null
|
|
},
|
|
{
|
|
"type": "TsMethodSignature",
|
|
"span": {
|
|
"start": 58,
|
|
"end": 70,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 58,
|
|
"end": 67,
|
|
"ctxt": 0
|
|
},
|
|
"value": "dontPanic",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"params": [],
|
|
"typeAnn": null,
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 84,
|
|
"end": 92,
|
|
"ctxt": 0
|
|
},
|
|
"value": "tryCatch",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 75,
|
|
"end": 587,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 95,
|
|
"end": 587,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "TryStatement",
|
|
"span": {
|
|
"start": 101,
|
|
"end": 585,
|
|
"ctxt": 0
|
|
},
|
|
"block": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 105,
|
|
"end": 135,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": []
|
|
},
|
|
"handler": {
|
|
"type": "CatchClause",
|
|
"span": {
|
|
"start": 140,
|
|
"end": 585,
|
|
"ctxt": 0
|
|
},
|
|
"param": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 147,
|
|
"end": 150,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 152,
|
|
"end": 585,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 214,
|
|
"end": 579,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 218,
|
|
"end": 233,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 218,
|
|
"end": 228,
|
|
"ctxt": 0
|
|
},
|
|
"value": "isFooError",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 229,
|
|
"end": 232,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 235,
|
|
"end": 368,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 249,
|
|
"end": 265,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 249,
|
|
"end": 264,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 249,
|
|
"end": 262,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 249,
|
|
"end": 252,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 253,
|
|
"end": 262,
|
|
"ctxt": 0
|
|
},
|
|
"value": "dontPanic",
|
|
"optional": false
|
|
}
|
|
},
|
|
"arguments": [],
|
|
"typeArguments": null
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 284,
|
|
"end": 298,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 284,
|
|
"end": 297,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 284,
|
|
"end": 295,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 284,
|
|
"end": 287,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 288,
|
|
"end": 295,
|
|
"ctxt": 0
|
|
},
|
|
"value": "doPanic",
|
|
"optional": false
|
|
}
|
|
},
|
|
"arguments": [],
|
|
"typeArguments": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 383,
|
|
"end": 579,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 387,
|
|
"end": 407,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "instanceof",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 387,
|
|
"end": 390,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 402,
|
|
"end": 407,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Error",
|
|
"optional": false
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 409,
|
|
"end": 530,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 423,
|
|
"end": 435,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 423,
|
|
"end": 434,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 423,
|
|
"end": 426,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 427,
|
|
"end": 434,
|
|
"ctxt": 0
|
|
},
|
|
"value": "message",
|
|
"optional": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 448,
|
|
"end": 460,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 448,
|
|
"end": 459,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 448,
|
|
"end": 451,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 452,
|
|
"end": 459,
|
|
"ctxt": 0
|
|
},
|
|
"value": "massage",
|
|
"optional": false
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 545,
|
|
"end": 579,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ThrowStatement",
|
|
"span": {
|
|
"start": 559,
|
|
"end": 569,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 565,
|
|
"end": 568,
|
|
"ctxt": 0
|
|
},
|
|
"value": "err",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"finalizer": null
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": null
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|