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

1164 lines
31 KiB
JSON

{
"type": "Script",
"span": {
"start": 72,
"end": 928,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 72,
"end": 158,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 81,
"end": 158,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 87,
"end": 105,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 94,
"end": 105,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 98,
"end": 104,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 98,
"end": 99,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 102,
"end": 104,
"ctxt": 0
},
"value": 12.0
},
"definite": false
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 119,
"end": 123,
"ctxt": 0
},
"value": "lt12",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 110,
"end": 156,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 126,
"end": 156,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 136,
"end": 150,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 147,
"end": 149,
"ctxt": 0
},
"value": 12.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 193,
"end": 272,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"value": "B",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 202,
"end": 272,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 208,
"end": 219,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 216,
"end": 218,
"ctxt": 0
},
"value": 12.0
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 233,
"end": 237,
"ctxt": 0
},
"value": "lt12",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 224,
"end": 270,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 240,
"end": 270,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 250,
"end": 264,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 257,
"end": 263,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 257,
"end": 258,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 261,
"end": 263,
"ctxt": 0
},
"value": 12.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 308,
"end": 368,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 315,
"end": 316,
"ctxt": 0
},
"value": "C",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 317,
"end": 368,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 332,
"end": 334,
"ctxt": 0
},
"value": "no",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 323,
"end": 366,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 337,
"end": 366,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 347,
"end": 360,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 354,
"end": 359,
"ctxt": 0
},
"value": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 396,
"end": 463,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": "D",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 405,
"end": 463,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 411,
"end": 461,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 427,
"end": 430,
"ctxt": 0
},
"value": "yes",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 418,
"end": 461,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 433,
"end": 461,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 443,
"end": 455,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 450,
"end": 454,
"ctxt": 0
},
"value": true
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 503,
"end": 703,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 510,
"end": 511,
"ctxt": 0
},
"value": "E",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 512,
"end": 703,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 518,
"end": 543,
"ctxt": 0
},
"declaration": {
"type": "TsEnumDeclaration",
"span": {
"start": 525,
"end": 543,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 530,
"end": 535,
"ctxt": 0
},
"value": "Color",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 538,
"end": 541,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 538,
"end": 541,
"ctxt": 0
},
"value": "Red",
"optional": false
},
"init": null
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 548,
"end": 572,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 564,
"end": 566,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 555,
"end": 572,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 569,
"end": 572,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 577,
"end": 610,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 584,
"end": 610,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 594,
"end": 595,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 596,
"end": 610,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 598,
"end": 608,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 598,
"end": 600,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 600,
"end": 608,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 602,
"end": 608,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 615,
"end": 646,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 628,
"end": 629,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 622,
"end": 646,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 632,
"end": 644,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 632,
"end": 636,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 636,
"end": 644,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 638,
"end": 644,
"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": 651,
"end": 701,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 658,
"end": 701,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 665,
"end": 666,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 667,
"end": 701,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 677,
"end": 695,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 684,
"end": 695,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 688,
"end": 694,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 688,
"end": 689,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 692,
"end": 694,
"ctxt": 0
},
"value": 42.0
},
"definite": false
}
]
}
}
]
}
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 770,
"end": 928,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 777,
"end": 778,
"ctxt": 0
},
"value": "F",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 779,
"end": 928,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 785,
"end": 803,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 790,
"end": 795,
"ctxt": 0
},
"value": "Color",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 798,
"end": 801,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 798,
"end": 801,
"ctxt": 0
},
"value": "Red",
"optional": false
},
"init": null
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 817,
"end": 819,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 808,
"end": 825,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 822,
"end": 825,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 830,
"end": 856,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 840,
"end": 841,
"ctxt": 0
},
"value": "I",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 842,
"end": 856,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 844,
"end": 854,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 844,
"end": 846,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 846,
"end": 854,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 848,
"end": 854,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 867,
"end": 868,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 861,
"end": 885,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 871,
"end": 883,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 871,
"end": 875,
"ctxt": 0
},
"value": "name",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 875,
"end": 883,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 877,
"end": 883,
"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": 890,
"end": 926,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 897,
"end": 898,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 899,
"end": 926,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 909,
"end": 920,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 913,
"end": 919,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 913,
"end": 914,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 917,
"end": 919,
"ctxt": 0
},
"value": 42.0
},
"definite": false
}
]
}
]
}
}
]
}
}
],
"interpreter": null
}