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

890 lines
30 KiB
JSON

{
"type": "Module",
"span": {
"start": 4,
"end": 763,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 4,
"end": 763,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 11,
"end": 763,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 18,
"end": 37,
"ctxt": 0
},
"value": "CompilerDiagnostics",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 38,
"end": 763,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 48,
"end": 73,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 55,
"end": 73,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 59,
"end": 72,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 59,
"end": 64,
"ctxt": 0
},
"value": "debug",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"value": false
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 82,
"end": 169,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 89,
"end": 169,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 116,
"ctxt": 0
},
"value": "IDiagnosticWriter",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 117,
"end": 169,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 131,
"end": 159,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 131,
"end": 136,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 137,
"end": 151,
"ctxt": 0
},
"value": "output",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 143,
"end": 151,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 145,
"end": 151,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 152,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 154,
"end": 158,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 179,
"end": 233,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 186,
"end": 233,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 190,
"end": 232,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 190,
"end": 206,
"ctxt": 0
},
"value": "diagnosticWriter",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 206,
"end": 225,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 208,
"end": 225,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 208,
"end": 225,
"ctxt": 0
},
"value": "IDiagnosticWriter",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "NullLiteral",
"span": {
"start": 228,
"end": 232,
"ctxt": 0
}
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 243,
"end": 279,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 250,
"end": 279,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 254,
"end": 278,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 254,
"end": 266,
"ctxt": 0
},
"value": "analysisPass",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 266,
"end": 274,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 268,
"end": 274,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": 0.0
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 289,
"end": 436,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 305,
"end": 310,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 311,
"end": 325,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 311,
"end": 325,
"ctxt": 0
},
"value": "output",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 317,
"end": 325,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 319,
"end": 325,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 296,
"end": 436,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 327,
"end": 436,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 341,
"end": 426,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 345,
"end": 361,
"ctxt": 0
},
"value": "diagnosticWriter",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 363,
"end": 426,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 381,
"end": 412,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 381,
"end": 411,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 381,
"end": 403,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 381,
"end": 397,
"ctxt": 0
},
"value": "diagnosticWriter",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 398,
"end": 403,
"ctxt": 0
},
"value": "Alert",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 404,
"end": 410,
"ctxt": 0
},
"value": "output",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 446,
"end": 560,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 462,
"end": 472,
"ctxt": 0
},
"value": "debugPrint",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 473,
"end": 482,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 473,
"end": 482,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 474,
"end": 482,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 476,
"end": 482,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 453,
"end": 560,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 484,
"end": 560,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 498,
"end": 550,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 502,
"end": 507,
"ctxt": 0
},
"value": "debug",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 509,
"end": 550,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 527,
"end": 536,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 527,
"end": 535,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 527,
"end": 532,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 533,
"end": 534,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 570,
"end": 756,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 586,
"end": 592,
"ctxt": 0
},
"value": "assert",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 593,
"end": 611,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 593,
"end": 611,
"ctxt": 0
},
"value": "condition",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 602,
"end": 611,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 604,
"end": 611,
"ctxt": 0
},
"kind": "boolean"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 613,
"end": 622,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 613,
"end": 622,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 614,
"end": 622,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 616,
"end": 622,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 577,
"end": 756,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 624,
"end": 756,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 638,
"end": 746,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 642,
"end": 647,
"ctxt": 0
},
"value": "debug",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 649,
"end": 746,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 667,
"end": 732,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 671,
"end": 681,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "Identifier",
"span": {
"start": 672,
"end": 681,
"ctxt": 0
},
"value": "condition",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 683,
"end": 732,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 705,
"end": 714,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 705,
"end": 713,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 705,
"end": 710,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 711,
"end": 712,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
],
"interpreter": null
}