mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
019cf37199
**Related issue:** - https://github.com/microsoft/TypeScript/pull/51865.
1940 lines
52 KiB
JSON
1940 lines
52 KiB
JSON
{
|
|
"type": "Script",
|
|
"span": {
|
|
"start": 33,
|
|
"end": 1011,
|
|
"ctxt": 0
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 33,
|
|
"end": 75,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 37,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 37,
|
|
"end": 38,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 38,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 40,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 40,
|
|
"end": 46,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
},
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 49,
|
|
"end": 55,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "number"
|
|
},
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 58,
|
|
"end": 65,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "boolean"
|
|
},
|
|
{
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 68,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 68,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"value": "RegExp",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 76,
|
|
"end": 94,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 80,
|
|
"end": 93,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 80,
|
|
"end": 84,
|
|
"ctxt": 0
|
|
},
|
|
"value": "cond",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 84,
|
|
"end": 93,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 86,
|
|
"end": 93,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 96,
|
|
"end": 104,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 96,
|
|
"end": 103,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 96,
|
|
"end": 97,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "RegExpLiteral",
|
|
"span": {
|
|
"start": 100,
|
|
"end": 103,
|
|
"ctxt": 0
|
|
},
|
|
"pattern": "a",
|
|
"flags": ""
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 105,
|
|
"end": 209,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "SequenceExpression",
|
|
"span": {
|
|
"start": 109,
|
|
"end": 135,
|
|
"ctxt": 0
|
|
},
|
|
"expressions": [
|
|
{
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 109,
|
|
"end": 110,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
},
|
|
{
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 125,
|
|
"end": 135,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 126,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 126,
|
|
"end": 127,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "BooleanLiteral",
|
|
"span": {
|
|
"start": 130,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"value": true
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 137,
|
|
"end": 170,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 143,
|
|
"end": 145,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 143,
|
|
"end": 144,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 161,
|
|
"end": 168,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 161,
|
|
"end": 167,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 161,
|
|
"end": 162,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 165,
|
|
"end": 167,
|
|
"ctxt": 0
|
|
},
|
|
"value": "",
|
|
"raw": "\"\""
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 176,
|
|
"end": 209,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 182,
|
|
"end": 184,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 182,
|
|
"end": 183,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 200,
|
|
"end": 207,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 200,
|
|
"end": 206,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 200,
|
|
"end": 201,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 204,
|
|
"end": 206,
|
|
"ctxt": 0
|
|
},
|
|
"value": 42.0,
|
|
"raw": "42"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 210,
|
|
"end": 212,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 210,
|
|
"end": 211,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 242,
|
|
"end": 243,
|
|
"ctxt": 0
|
|
},
|
|
"value": "a",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 233,
|
|
"end": 381,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 246,
|
|
"end": 381,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 252,
|
|
"end": 275,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 256,
|
|
"end": 274,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 256,
|
|
"end": 257,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 257,
|
|
"end": 274,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 259,
|
|
"end": 274,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 259,
|
|
"end": 265,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
},
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 268,
|
|
"end": 274,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "number"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 280,
|
|
"end": 362,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 284,
|
|
"end": 288,
|
|
"ctxt": 0
|
|
},
|
|
"value": "cond",
|
|
"optional": false
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 290,
|
|
"end": 313,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 300,
|
|
"end": 307,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 300,
|
|
"end": 306,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 300,
|
|
"end": 301,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 304,
|
|
"end": 306,
|
|
"ctxt": 0
|
|
},
|
|
"value": 42.0,
|
|
"raw": "42"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 323,
|
|
"end": 362,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 333,
|
|
"end": 340,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 333,
|
|
"end": 339,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 333,
|
|
"end": 334,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 337,
|
|
"end": 339,
|
|
"ctxt": 0
|
|
},
|
|
"value": "",
|
|
"raw": "\"\""
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 349,
|
|
"end": 356,
|
|
"ctxt": 0
|
|
},
|
|
"argument": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 367,
|
|
"end": 369,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 367,
|
|
"end": 368,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": null
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 391,
|
|
"end": 392,
|
|
"ctxt": 0
|
|
},
|
|
"value": "b",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 382,
|
|
"end": 532,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 395,
|
|
"end": 532,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 401,
|
|
"end": 424,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 405,
|
|
"end": 423,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 405,
|
|
"end": 406,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 406,
|
|
"end": 423,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 408,
|
|
"end": 423,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 408,
|
|
"end": 414,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
},
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 417,
|
|
"end": 423,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "number"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 429,
|
|
"end": 513,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 433,
|
|
"end": 437,
|
|
"ctxt": 0
|
|
},
|
|
"value": "cond",
|
|
"optional": false
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 439,
|
|
"end": 480,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 456,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 455,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 450,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 453,
|
|
"end": 455,
|
|
"ctxt": 0
|
|
},
|
|
"value": 42.0,
|
|
"raw": "42"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ThrowStatement",
|
|
"span": {
|
|
"start": 465,
|
|
"end": 474,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 471,
|
|
"end": 473,
|
|
"ctxt": 0
|
|
},
|
|
"value": "",
|
|
"raw": "\"\""
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 490,
|
|
"end": 513,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 500,
|
|
"end": 507,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 500,
|
|
"end": 506,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 500,
|
|
"end": 501,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 504,
|
|
"end": 506,
|
|
"ctxt": 0
|
|
},
|
|
"value": "",
|
|
"raw": "\"\""
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 518,
|
|
"end": 520,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 518,
|
|
"end": 519,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": null
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 542,
|
|
"end": 543,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 547,
|
|
"end": 563,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 547,
|
|
"end": 563,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 551,
|
|
"end": 563,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 553,
|
|
"end": 563,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 553,
|
|
"end": 559,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
},
|
|
{
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 562,
|
|
"end": 563,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 562,
|
|
"end": 563,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 533,
|
|
"end": 684,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 568,
|
|
"end": 684,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 574,
|
|
"end": 682,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 578,
|
|
"end": 602,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "===",
|
|
"left": {
|
|
"type": "UnaryExpression",
|
|
"span": {
|
|
"start": 578,
|
|
"end": 589,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "typeof",
|
|
"argument": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 585,
|
|
"end": 589,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 594,
|
|
"end": 602,
|
|
"ctxt": 0
|
|
},
|
|
"value": "string",
|
|
"raw": "'string'"
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 604,
|
|
"end": 644,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 614,
|
|
"end": 638,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 621,
|
|
"end": 637,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 621,
|
|
"end": 631,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 621,
|
|
"end": 625,
|
|
"ctxt": 0
|
|
},
|
|
"value": "JSON",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 626,
|
|
"end": 631,
|
|
"ctxt": 0
|
|
},
|
|
"value": "parse",
|
|
"optional": false
|
|
}
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 632,
|
|
"end": 636,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 654,
|
|
"end": 682,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 664,
|
|
"end": 676,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 671,
|
|
"end": 675,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": {
|
|
"type": "TsTypeParameterDeclaration",
|
|
"span": {
|
|
"start": 543,
|
|
"end": 546,
|
|
"ctxt": 0
|
|
},
|
|
"parameters": [
|
|
{
|
|
"type": "TsTypeParameter",
|
|
"span": {
|
|
"start": 544,
|
|
"end": 545,
|
|
"ctxt": 0
|
|
},
|
|
"name": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 544,
|
|
"end": 545,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"in": false,
|
|
"out": false,
|
|
"const": false,
|
|
"constraint": null,
|
|
"default": null
|
|
}
|
|
]
|
|
},
|
|
"returnType": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 564,
|
|
"end": 567,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 566,
|
|
"end": 567,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 566,
|
|
"end": 567,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 694,
|
|
"end": 695,
|
|
"ctxt": 0
|
|
},
|
|
"value": "d",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 714,
|
|
"end": 730,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 714,
|
|
"end": 730,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 718,
|
|
"end": 730,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 720,
|
|
"end": 730,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 720,
|
|
"end": 726,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
},
|
|
{
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 729,
|
|
"end": 730,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 729,
|
|
"end": 730,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 685,
|
|
"end": 869,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 739,
|
|
"end": 869,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 745,
|
|
"end": 867,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 749,
|
|
"end": 773,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "===",
|
|
"left": {
|
|
"type": "UnaryExpression",
|
|
"span": {
|
|
"start": 749,
|
|
"end": 760,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "typeof",
|
|
"argument": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 756,
|
|
"end": 760,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 765,
|
|
"end": 773,
|
|
"ctxt": 0
|
|
},
|
|
"value": "string",
|
|
"raw": "'string'"
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 775,
|
|
"end": 829,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ThrowStatement",
|
|
"span": {
|
|
"start": 785,
|
|
"end": 823,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "NewExpression",
|
|
"span": {
|
|
"start": 791,
|
|
"end": 822,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 795,
|
|
"end": 800,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Error",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 801,
|
|
"end": 821,
|
|
"ctxt": 0
|
|
},
|
|
"value": "will always happen",
|
|
"raw": "'will always happen'"
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 839,
|
|
"end": 867,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 849,
|
|
"end": 861,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 856,
|
|
"end": 860,
|
|
"ctxt": 0
|
|
},
|
|
"value": "data",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": {
|
|
"type": "TsTypeParameterDeclaration",
|
|
"span": {
|
|
"start": 695,
|
|
"end": 713,
|
|
"ctxt": 0
|
|
},
|
|
"parameters": [
|
|
{
|
|
"type": "TsTypeParameter",
|
|
"span": {
|
|
"start": 696,
|
|
"end": 712,
|
|
"ctxt": 0
|
|
},
|
|
"name": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 696,
|
|
"end": 697,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"in": false,
|
|
"out": false,
|
|
"const": false,
|
|
"constraint": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 706,
|
|
"end": 712,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
},
|
|
"default": null
|
|
}
|
|
]
|
|
},
|
|
"returnType": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 731,
|
|
"end": 738,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 733,
|
|
"end": 738,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "never"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "TsInterfaceDeclaration",
|
|
"span": {
|
|
"start": 871,
|
|
"end": 897,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 881,
|
|
"end": 882,
|
|
"ctxt": 0
|
|
},
|
|
"value": "I",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"typeParams": {
|
|
"type": "TsTypeParameterDeclaration",
|
|
"span": {
|
|
"start": 882,
|
|
"end": 885,
|
|
"ctxt": 0
|
|
},
|
|
"parameters": [
|
|
{
|
|
"type": "TsTypeParameter",
|
|
"span": {
|
|
"start": 883,
|
|
"end": 884,
|
|
"ctxt": 0
|
|
},
|
|
"name": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 883,
|
|
"end": 884,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"in": false,
|
|
"out": false,
|
|
"const": false,
|
|
"constraint": null,
|
|
"default": null
|
|
}
|
|
]
|
|
},
|
|
"extends": [],
|
|
"body": {
|
|
"type": "TsInterfaceBody",
|
|
"span": {
|
|
"start": 886,
|
|
"end": 897,
|
|
"ctxt": 0
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 890,
|
|
"end": 895,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 890,
|
|
"end": 891,
|
|
"ctxt": 0
|
|
},
|
|
"value": "p",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"init": null,
|
|
"params": [],
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 891,
|
|
"end": 894,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 893,
|
|
"end": 894,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 893,
|
|
"end": 894,
|
|
"ctxt": 0
|
|
},
|
|
"value": "T",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 907,
|
|
"end": 908,
|
|
"ctxt": 0
|
|
},
|
|
"value": "e",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 909,
|
|
"end": 924,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 909,
|
|
"end": 924,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 910,
|
|
"end": 924,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 912,
|
|
"end": 924,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 912,
|
|
"end": 913,
|
|
"ctxt": 0
|
|
},
|
|
"value": "I",
|
|
"optional": false
|
|
},
|
|
"typeParams": {
|
|
"type": "TsTypeParameterInstantiation",
|
|
"span": {
|
|
"start": 913,
|
|
"end": 924,
|
|
"ctxt": 0
|
|
},
|
|
"params": [
|
|
{
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 914,
|
|
"end": 923,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 914,
|
|
"end": 917,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 914,
|
|
"end": 917,
|
|
"ctxt": 0
|
|
},
|
|
"value": "A",
|
|
"raw": "\"A\""
|
|
}
|
|
},
|
|
{
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 920,
|
|
"end": 923,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 920,
|
|
"end": 923,
|
|
"ctxt": 0
|
|
},
|
|
"value": "B",
|
|
"raw": "\"B\""
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 898,
|
|
"end": 1011,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 926,
|
|
"end": 1011,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 932,
|
|
"end": 1009,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 936,
|
|
"end": 947,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "===",
|
|
"left": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 936,
|
|
"end": 939,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 936,
|
|
"end": 937,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 938,
|
|
"end": 939,
|
|
"ctxt": 0
|
|
},
|
|
"value": "p",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 944,
|
|
"end": 947,
|
|
"ctxt": 0
|
|
},
|
|
"value": "A",
|
|
"raw": "\"A\""
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 949,
|
|
"end": 1009,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 959,
|
|
"end": 1003,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 963,
|
|
"end": 1003,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 963,
|
|
"end": 964,
|
|
"ctxt": 0
|
|
},
|
|
"value": "a",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 964,
|
|
"end": 969,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 966,
|
|
"end": 969,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 966,
|
|
"end": 969,
|
|
"ctxt": 0
|
|
},
|
|
"value": "A",
|
|
"raw": "\"A\""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"init": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 972,
|
|
"end": 1003,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "TsAsExpression",
|
|
"span": {
|
|
"start": 973,
|
|
"end": 1002,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "TsAsExpression",
|
|
"span": {
|
|
"start": 973,
|
|
"end": 988,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "NullLiteral",
|
|
"span": {
|
|
"start": 973,
|
|
"end": 977,
|
|
"ctxt": 0
|
|
}
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 981,
|
|
"end": 988,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "unknown"
|
|
}
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsTypeQuery",
|
|
"span": {
|
|
"start": 992,
|
|
"end": 1002,
|
|
"ctxt": 0
|
|
},
|
|
"exprName": {
|
|
"type": "TsQualifiedName",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 999,
|
|
"end": 1000,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 1001,
|
|
"end": 1002,
|
|
"ctxt": 0
|
|
},
|
|
"value": "p",
|
|
"optional": false
|
|
}
|
|
},
|
|
"typeArguments": null
|
|
}
|
|
}
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"alternate": null
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": null
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|