mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
858 lines
21 KiB
JSON
858 lines
21 KiB
JSON
{
|
|
"type": "Script",
|
|
"span": {
|
|
"start": 1,
|
|
"end": 488,
|
|
"ctxt": 0
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 1,
|
|
"end": 14,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 5,
|
|
"end": 13,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 5,
|
|
"end": 6,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 6,
|
|
"end": 13,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 8,
|
|
"end": 13,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 8,
|
|
"end": 13,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"raw": "\"foo\""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 15,
|
|
"end": 36,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 19,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 19,
|
|
"end": 20,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 20,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsUnionType",
|
|
"span": {
|
|
"start": 22,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"types": [
|
|
{
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 22,
|
|
"end": 27,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 22,
|
|
"end": 27,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"raw": "\"foo\""
|
|
}
|
|
},
|
|
{
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 30,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 30,
|
|
"end": 35,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"span": {
|
|
"start": 38,
|
|
"end": 51,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "let",
|
|
"declare": false,
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"span": {
|
|
"start": 42,
|
|
"end": 50,
|
|
"ctxt": 0
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 42,
|
|
"end": 43,
|
|
"ctxt": 0
|
|
},
|
|
"value": "z",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 43,
|
|
"end": 50,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsLiteralType",
|
|
"span": {
|
|
"start": 45,
|
|
"end": 50,
|
|
"ctxt": 0
|
|
},
|
|
"literal": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 45,
|
|
"end": 50,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"init": null,
|
|
"definite": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 70,
|
|
"end": 78,
|
|
"ctxt": 0
|
|
},
|
|
"value": "randBool",
|
|
"optional": false
|
|
},
|
|
"declare": true,
|
|
"params": [],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 53,
|
|
"end": 90,
|
|
"ctxt": 0
|
|
},
|
|
"body": null,
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 80,
|
|
"end": 89,
|
|
"ctxt": 0
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 82,
|
|
"end": 89,
|
|
"ctxt": 0
|
|
},
|
|
"kind": "boolean"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "SwitchStatement",
|
|
"span": {
|
|
"start": 92,
|
|
"end": 488,
|
|
"ctxt": 0
|
|
},
|
|
"discriminant": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 100,
|
|
"end": 101,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
},
|
|
"cases": [
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 109,
|
|
"end": 156,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "ConditionalExpression",
|
|
"span": {
|
|
"start": 114,
|
|
"end": 140,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 114,
|
|
"end": 124,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 114,
|
|
"end": 122,
|
|
"ctxt": 0
|
|
},
|
|
"value": "randBool",
|
|
"optional": false
|
|
},
|
|
"arguments": [],
|
|
"typeArguments": null
|
|
},
|
|
"consequent": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 127,
|
|
"end": 132,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"raw": "\"foo\""
|
|
},
|
|
"alternate": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 135,
|
|
"end": 140,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 150,
|
|
"end": 156,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 161,
|
|
"end": 228,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 166,
|
|
"end": 212,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "ConditionalExpression",
|
|
"span": {
|
|
"start": 167,
|
|
"end": 211,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 167,
|
|
"end": 177,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 167,
|
|
"end": 175,
|
|
"ctxt": 0
|
|
},
|
|
"value": "randBool",
|
|
"optional": false
|
|
},
|
|
"arguments": [],
|
|
"typeArguments": null
|
|
},
|
|
"consequent": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 180,
|
|
"end": 187,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 181,
|
|
"end": 186,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
}
|
|
},
|
|
"alternate": {
|
|
"type": "ConditionalExpression",
|
|
"span": {
|
|
"start": 190,
|
|
"end": 211,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 190,
|
|
"end": 195,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
},
|
|
"consequent": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 198,
|
|
"end": 203,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
},
|
|
"alternate": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 206,
|
|
"end": 211,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 222,
|
|
"end": 228,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 233,
|
|
"end": 263,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 238,
|
|
"end": 247,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 239,
|
|
"end": 246,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 240,
|
|
"end": 245,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
}
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 257,
|
|
"end": 263,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 268,
|
|
"end": 326,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 273,
|
|
"end": 288,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "SequenceExpression",
|
|
"span": {
|
|
"start": 274,
|
|
"end": 287,
|
|
"ctxt": 0
|
|
},
|
|
"expressions": [
|
|
{
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 274,
|
|
"end": 275,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
},
|
|
{
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 277,
|
|
"end": 278,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false
|
|
},
|
|
{
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 280,
|
|
"end": 287,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 281,
|
|
"end": 286,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 298,
|
|
"end": 300,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 298,
|
|
"end": 299,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 309,
|
|
"end": 311,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 309,
|
|
"end": 310,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 320,
|
|
"end": 326,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 331,
|
|
"end": 372,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 336,
|
|
"end": 356,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 337,
|
|
"end": 355,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 338,
|
|
"end": 354,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "||",
|
|
"left": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 338,
|
|
"end": 343,
|
|
"ctxt": 0
|
|
},
|
|
"value": "foo",
|
|
"raw": "\"foo\""
|
|
},
|
|
"right": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 347,
|
|
"end": 354,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 348,
|
|
"end": 353,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 366,
|
|
"end": 372,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 377,
|
|
"end": 418,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 382,
|
|
"end": 402,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 383,
|
|
"end": 401,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 384,
|
|
"end": 400,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "||",
|
|
"left": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 384,
|
|
"end": 389,
|
|
"ctxt": 0
|
|
},
|
|
"value": "bar",
|
|
"raw": "\"bar\""
|
|
},
|
|
"right": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 393,
|
|
"end": 400,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 394,
|
|
"end": 399,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 412,
|
|
"end": 418,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 423,
|
|
"end": 439,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 428,
|
|
"end": 438,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "||",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 428,
|
|
"end": 429,
|
|
"ctxt": 0
|
|
},
|
|
"value": "z",
|
|
"optional": false
|
|
},
|
|
"right": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 433,
|
|
"end": 438,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
}
|
|
},
|
|
"consequent": []
|
|
},
|
|
{
|
|
"type": "SwitchCase",
|
|
"span": {
|
|
"start": 444,
|
|
"end": 486,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 459,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "||",
|
|
"left": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 454,
|
|
"ctxt": 0
|
|
},
|
|
"value": "baz",
|
|
"raw": "\"baz\""
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 458,
|
|
"end": 459,
|
|
"ctxt": 0
|
|
},
|
|
"value": "z",
|
|
"optional": false
|
|
}
|
|
},
|
|
"consequent": [
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 469,
|
|
"end": 471,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 469,
|
|
"end": 470,
|
|
"ctxt": 0
|
|
},
|
|
"value": "z",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"type": "BreakStatement",
|
|
"span": {
|
|
"start": 480,
|
|
"end": 486,
|
|
"ctxt": 0
|
|
},
|
|
"label": null
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|