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

1099 lines
30 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 539,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 1,
"end": 268,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 10,
"end": 268,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 17,
"end": 75,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 33,
"end": 35,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 24,
"end": 75,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 47,
"end": 75,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 57,
"end": 69,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 64,
"end": 68,
"ctxt": 0
},
"value": true
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 81,
"end": 144,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"value": "fng",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 88,
"end": 144,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 116,
"end": 144,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 126,
"end": 138,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 133,
"end": 137,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 112,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 159,
"end": 162,
"ctxt": 0
},
"value": "fn2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 163,
"end": 172,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 163,
"end": 172,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 164,
"end": 172,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 166,
"end": 172,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 150,
"end": 203,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 174,
"end": 203,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 184,
"end": 197,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 191,
"end": 196,
"ctxt": 0
},
"value": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 218,
"end": 222,
"ctxt": 0
},
"value": "fng2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 229,
"end": 233,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 229,
"end": 233,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 230,
"end": 233,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 209,
"end": 266,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 238,
"end": 266,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 248,
"end": 260,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 255,
"end": 259,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 222,
"end": 228,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 223,
"end": 224,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 223,
"end": 224,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 234,
"end": 237,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 333,
"end": 364,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 337,
"end": 363,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 337,
"end": 339,
"ctxt": 0
},
"value": "fn",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 339,
"end": 363,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 341,
"end": 363,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 342,
"end": 351,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 343,
"end": 351,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 345,
"end": 351,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 353,
"end": 363,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 356,
"end": 363,
"ctxt": 0
},
"kind": "boolean"
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 365,
"end": 379,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 369,
"end": 378,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 369,
"end": 371,
"ctxt": 0
},
"value": "fn",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 374,
"end": 378,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 374,
"end": 375,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 376,
"end": 378,
"ctxt": 0
},
"value": "fn",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 381,
"end": 408,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 385,
"end": 407,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 385,
"end": 388,
"ctxt": 0
},
"value": "fng",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 388,
"end": 407,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 390,
"end": 407,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 397,
"end": 401,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 400,
"end": 401,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 400,
"end": 401,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 390,
"end": 396,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 394,
"end": 395,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 394,
"end": 395,
"ctxt": 0
},
"value": "U",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 403,
"end": 407,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 406,
"end": 407,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 406,
"end": 407,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 409,
"end": 425,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 413,
"end": 424,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 413,
"end": 416,
"ctxt": 0
},
"value": "fng",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 419,
"end": 424,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 419,
"end": 420,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 421,
"end": 424,
"ctxt": 0
},
"value": "fng",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 504,
"end": 520,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 508,
"end": 519,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 508,
"end": 511,
"ctxt": 0
},
"value": "fn2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 514,
"end": 519,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 516,
"end": 519,
"ctxt": 0
},
"value": "fn2",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 521,
"end": 539,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 525,
"end": 538,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 525,
"end": 529,
"ctxt": 0
},
"value": "fng2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 532,
"end": 538,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 532,
"end": 533,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 534,
"end": 538,
"ctxt": 0
},
"value": "fng2",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}