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

1170 lines
31 KiB
JSON

{
"type": "Script",
"span": {
"start": 73,
"end": 929,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 73,
"end": 159,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 82,
"end": 159,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 88,
"end": 106,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 95,
"end": 106,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 103,
"end": 105,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
},
"definite": false
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 120,
"end": 124,
"ctxt": 0
},
"value": "lt12",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 111,
"end": 157,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 127,
"end": 157,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 137,
"end": 151,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 148,
"end": 150,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 194,
"end": 273,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "B",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 203,
"end": 273,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 209,
"end": 220,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 217,
"end": 219,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 234,
"end": 238,
"ctxt": 0
},
"value": "lt12",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 225,
"end": 271,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 241,
"end": 271,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 251,
"end": 265,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 258,
"end": 264,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 258,
"end": 259,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 262,
"end": 264,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 309,
"end": 369,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "C",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 318,
"end": 369,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 333,
"end": 335,
"ctxt": 0
},
"value": "no",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 324,
"end": 367,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 338,
"end": 367,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 348,
"end": 361,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 355,
"end": 360,
"ctxt": 0
},
"value": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 397,
"end": 464,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "D",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 406,
"end": 464,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 412,
"end": 462,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 428,
"end": 431,
"ctxt": 0
},
"value": "yes",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 419,
"end": 462,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 434,
"end": 462,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 444,
"end": 456,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 451,
"end": 455,
"ctxt": 0
},
"value": true
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 504,
"end": 704,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 511,
"end": 512,
"ctxt": 0
},
"value": "E",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 513,
"end": 704,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 519,
"end": 544,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 526,
"end": 544,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 531,
"end": 536,
"ctxt": 0
},
"value": "Color",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 539,
"end": 542,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 539,
"end": 542,
"ctxt": 0
},
"value": "Red",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 549,
"end": 573,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 565,
"end": 567,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 556,
"end": 573,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 570,
"end": 573,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 578,
"end": 611,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 585,
"end": 611,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 597,
"end": 611,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 599,
"end": 609,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 599,
"end": 601,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 601,
"end": 609,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 603,
"end": 609,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 616,
"end": 647,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 629,
"end": 630,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 623,
"end": 647,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 633,
"end": 645,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 633,
"end": 637,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 637,
"end": 645,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 639,
"end": 645,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 652,
"end": 702,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 659,
"end": 702,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 666,
"end": 667,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 668,
"end": 702,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 678,
"end": 696,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 685,
"end": 696,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 689,
"end": 695,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 689,
"end": 690,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 693,
"end": 695,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
}
]
}
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 771,
"end": 929,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 778,
"end": 779,
"ctxt": 0
},
"value": "F",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 780,
"end": 929,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 786,
"end": 804,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 791,
"end": 796,
"ctxt": 0
},
"value": "Color",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 799,
"end": 802,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 799,
"end": 802,
"ctxt": 0
},
"value": "Red",
"optional": false
},
"init": null
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 818,
"end": 820,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 809,
"end": 826,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 823,
"end": 826,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 831,
"end": 857,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 841,
"end": 842,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 843,
"end": 857,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 845,
"end": 855,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 845,
"end": 847,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 847,
"end": 855,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 849,
"end": 855,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 868,
"end": 869,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 862,
"end": 886,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 872,
"end": 884,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 872,
"end": 876,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 876,
"end": 884,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 878,
"end": 884,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 891,
"end": 927,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 898,
"end": 899,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 900,
"end": 927,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 910,
"end": 921,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 914,
"end": 920,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 914,
"end": 915,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 918,
"end": 920,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
]
}
}
]
}
}
],
"interpreter": null
}