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

1081 lines
29 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 538,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 0,
"end": 267,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 7,
"end": 8,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 9,
"end": 267,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 16,
"end": 74,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 35,
"end": 44,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 35,
"end": 44,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 36,
"end": 44,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 23,
"end": 74,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 46,
"end": 74,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 56,
"end": 68,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"value": true
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 80,
"end": 143,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 96,
"end": 99,
"ctxt": 0
},
"value": "fng",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 107,
"end": 110,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 87,
"end": 143,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 115,
"end": 143,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 125,
"end": 137,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 132,
"end": 136,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 100,
"end": 101,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 100,
"end": 101,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 158,
"end": 161,
"ctxt": 0
},
"value": "fn2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 162,
"end": 171,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 162,
"end": 171,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 163,
"end": 171,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 165,
"end": 171,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 149,
"end": 202,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 173,
"end": 202,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 183,
"end": 196,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 190,
"end": 195,
"ctxt": 0
},
"value": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 217,
"end": 221,
"ctxt": 0
},
"value": "fng2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 228,
"end": 232,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 228,
"end": 232,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 229,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 208,
"end": 265,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 237,
"end": 265,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 247,
"end": 259,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 254,
"end": 258,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 221,
"end": 227,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 233,
"end": 236,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 332,
"end": 363,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 336,
"end": 362,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 336,
"end": 338,
"ctxt": 0
},
"value": "fn",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 338,
"end": 362,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 340,
"end": 362,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 341,
"end": 350,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 342,
"end": 350,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 344,
"end": 350,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 352,
"end": 362,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 355,
"end": 362,
"ctxt": 0
},
"kind": "boolean"
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 364,
"end": 378,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 368,
"end": 377,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 368,
"end": 370,
"ctxt": 0
},
"value": "fn",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 373,
"end": 377,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 373,
"end": 374,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 375,
"end": 377,
"ctxt": 0
},
"value": "fn",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 380,
"end": 407,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 384,
"end": 406,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 384,
"end": 387,
"ctxt": 0
},
"value": "fng",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 387,
"end": 406,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 389,
"end": 406,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 396,
"end": 400,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 397,
"end": 400,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 399,
"end": 400,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 399,
"end": 400,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 389,
"end": 395,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 393,
"end": 394,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 393,
"end": 394,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 402,
"end": 406,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 405,
"end": 406,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 405,
"end": 406,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 408,
"end": 424,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 412,
"end": 423,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 412,
"end": 415,
"ctxt": 0
},
"value": "fng",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 418,
"end": 423,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 418,
"end": 419,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 420,
"end": 423,
"ctxt": 0
},
"value": "fng",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 503,
"end": 519,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 507,
"end": 518,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 507,
"end": 510,
"ctxt": 0
},
"value": "fn2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 513,
"end": 518,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 515,
"end": 518,
"ctxt": 0
},
"value": "fn2",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 520,
"end": 538,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 524,
"end": 537,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 524,
"end": 528,
"ctxt": 0
},
"value": "fng2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 531,
"end": 537,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 531,
"end": 532,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 533,
"end": 537,
"ctxt": 0
},
"value": "fng2",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}