mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 11:13:43 +03:00
752 lines
17 KiB
JSON
752 lines
17 KiB
JSON
{
|
|
"type": "Script",
|
|
"span": {
|
|
"start": 0,
|
|
"end": 384,
|
|
"ctxt": 0
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 0,
|
|
"end": 21,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "const",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 6,
|
|
"end": 20,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 6,
|
|
"end": 14,
|
|
"ctxt": 0
|
|
},
|
|
"value": "keywordA",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"init": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 17,
|
|
"end": 20,
|
|
"ctxt": 0
|
|
},
|
|
"value": "a",
|
|
"raw": "'a'"
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 22,
|
|
"end": 43,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "const",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 28,
|
|
"end": 42,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 28,
|
|
"end": 36,
|
|
"ctxt": 0
|
|
},
|
|
"value": "keywordB",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
},
|
|
"init": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 39,
|
|
"end": 42,
|
|
"ctxt": 0
|
|
},
|
|
"value": "b",
|
|
"raw": "'b'"
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "TsTypeAliasDeclaration",
|
|
"span": {
|
|
"start": 45,
|
|
"end": 77,
|
|
"ctxt": 0
|
|
},
|
|
"declare": false,
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 50,
|
|
"end": 51,
|
|
"ctxt": 0
|
|
},
|
|
"value": "A",
|
|
"optional": false
|
|
},
|
|
"typeParams": null,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 54,
|
|
"end": 76,
|
|
"ctxt": 0
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 56,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 57,
|
|
"end": 65,
|
|
"ctxt": 0
|
|
},
|
|
"value": "keywordA",
|
|
"optional": false
|
|
},
|
|
"computed": true,
|
|
"optional": false,
|
|
"init": null,
|
|
"params": [],
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 66,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 68,
|
|
"end": 74,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "number"
|
|
}
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "TsTypeAliasDeclaration",
|
|
"span": {
|
|
"start": 78,
|
|
"end": 110,
|
|
"ctxt": 0
|
|
},
|
|
"declare": false,
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 83,
|
|
"end": 84,
|
|
"ctxt": 0
|
|
},
|
|
"value": "B",
|
|
"optional": false
|
|
},
|
|
"typeParams": null,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 87,
|
|
"end": 109,
|
|
"ctxt": 0
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 89,
|
|
"end": 107,
|
|
"ctxt": 0
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 90,
|
|
"end": 98,
|
|
"ctxt": 0
|
|
},
|
|
"value": "keywordB",
|
|
"optional": false
|
|
},
|
|
"computed": true,
|
|
"optional": false,
|
|
"init": null,
|
|
"params": [],
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 99,
|
|
"end": 107,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 101,
|
|
"end": 107,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
}
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 112,
|
|
"end": 135,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "const",
|
|
"declare": true,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 126,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 126,
|
|
"end": 127,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 127,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 129,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 129,
|
|
"end": 130,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 129,
|
|
"end": 130,
|
|
"ctxt": 0
|
|
},
|
|
"value": "A",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
},
|
|
{
|
|
"type": "TsTypeReference",
|
|
"span": {
|
|
"start": 133,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"typeName": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 133,
|
|
"end": 134,
|
|
"ctxt": 0
|
|
},
|
|
"value": "B",
|
|
"optional": false
|
|
},
|
|
"typeParams": null
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 137,
|
|
"end": 180,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 141,
|
|
"end": 149,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "in",
|
|
"left": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 141,
|
|
"end": 144,
|
|
"ctxt": 0
|
|
},
|
|
"value": "a",
|
|
"raw": "'a'"
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 148,
|
|
"end": 149,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 151,
|
|
"end": 180,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 157,
|
|
"end": 159,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 157,
|
|
"end": 158,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": null
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 182,
|
|
"end": 235,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 186,
|
|
"end": 199,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "in",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 186,
|
|
"end": 194,
|
|
"ctxt": 0
|
|
},
|
|
"value": "keywordA",
|
|
"optional": false
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 198,
|
|
"end": 199,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 201,
|
|
"end": 235,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 207,
|
|
"end": 209,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 207,
|
|
"end": 208,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": null
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 237,
|
|
"end": 263,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 241,
|
|
"end": 262,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 241,
|
|
"end": 248,
|
|
"ctxt": 0
|
|
},
|
|
"value": "stringB",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 248,
|
|
"end": 256,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 250,
|
|
"end": 256,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "string"
|
|
}
|
|
}
|
|
},
|
|
"init": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 259,
|
|
"end": 262,
|
|
"ctxt": 0
|
|
},
|
|
"value": "b",
|
|
"raw": "'b'"
|
|
},
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 265,
|
|
"end": 321,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 269,
|
|
"end": 290,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "in",
|
|
"left": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 269,
|
|
"end": 285,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "TsAsExpression",
|
|
"span": {
|
|
"start": 270,
|
|
"end": 284,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 270,
|
|
"end": 277,
|
|
"ctxt": 0
|
|
},
|
|
"value": "stringB",
|
|
"optional": false
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 281,
|
|
"end": 284,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 281,
|
|
"end": 284,
|
|
"ctxt": 0
|
|
},
|
|
"value": "b",
|
|
"raw": "'b'"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 289,
|
|
"end": 290,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 292,
|
|
"end": 321,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 298,
|
|
"end": 300,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 298,
|
|
"end": 299,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": null
|
|
},
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 323,
|
|
"end": 384,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 327,
|
|
"end": 356,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "in",
|
|
"left": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 327,
|
|
"end": 351,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "TsAsExpression",
|
|
"span": {
|
|
"start": 328,
|
|
"end": 350,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 328,
|
|
"end": 335,
|
|
"ctxt": 0
|
|
},
|
|
"value": "stringB",
|
|
"optional": false
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsParenthesizedType",
|
|
"span": {
|
|
"start": 339,
|
|
"end": 350,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 340,
|
|
"end": 349,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 340,
|
|
"end": 343,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 340,
|
|
"end": 343,
|
|
"ctxt": 0
|
|
},
|
|
"value": "a",
|
|
"raw": "'a'"
|
|
}
|
|
},
|
|
{
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 346,
|
|
"end": 349,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 346,
|
|
"end": 349,
|
|
"ctxt": 0
|
|
},
|
|
"value": "b",
|
|
"raw": "'b'"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 355,
|
|
"end": 356,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 358,
|
|
"end": 384,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 364,
|
|
"end": 366,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 364,
|
|
"end": 365,
|
|
"ctxt": 0
|
|
},
|
|
"value": "c",
|
|
"optional": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": null
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|