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

891 lines
30 KiB
JSON

{
"type": "Module",
"span": {
"start": 5,
"end": 764,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 5,
"end": 764,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 12,
"end": 764,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 19,
"end": 38,
"ctxt": 0
},
"value": "CompilerDiagnostics",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 39,
"end": 764,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 49,
"end": 74,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 56,
"end": 74,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 60,
"end": 73,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 60,
"end": 65,
"ctxt": 0
},
"value": "debug",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 68,
"end": 73,
"ctxt": 0
},
"value": false
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 83,
"end": 170,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 90,
"end": 170,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 100,
"end": 117,
"ctxt": 0
},
"value": "IDiagnosticWriter",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 118,
"end": 170,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 132,
"end": 160,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 138,
"end": 152,
"ctxt": 0
},
"value": "output",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 152,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 155,
"end": 159,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 180,
"end": 234,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 187,
"end": 234,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 191,
"end": 233,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 191,
"end": 207,
"ctxt": 0
},
"value": "diagnosticWriter",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 207,
"end": 226,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 209,
"end": 226,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 209,
"end": 226,
"ctxt": 0
},
"value": "IDiagnosticWriter",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "NullLiteral",
"span": {
"start": 229,
"end": 233,
"ctxt": 0
}
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 244,
"end": 280,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 251,
"end": 280,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 255,
"end": 279,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 255,
"end": 267,
"ctxt": 0
},
"value": "analysisPass",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 267,
"end": 275,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 269,
"end": 275,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 278,
"end": 279,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 290,
"end": 437,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 306,
"end": 311,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 312,
"end": 326,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 312,
"end": 326,
"ctxt": 0
},
"value": "output",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 318,
"end": 326,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 320,
"end": 326,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 297,
"end": 437,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 328,
"end": 437,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 342,
"end": 427,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 346,
"end": 362,
"ctxt": 0
},
"value": "diagnosticWriter",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 364,
"end": 427,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 382,
"end": 413,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 382,
"end": 412,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 382,
"end": 404,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 382,
"end": 398,
"ctxt": 0
},
"value": "diagnosticWriter",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 399,
"end": 404,
"ctxt": 0
},
"value": "Alert",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 405,
"end": 411,
"ctxt": 0
},
"value": "output",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 447,
"end": 561,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 463,
"end": 473,
"ctxt": 0
},
"value": "debugPrint",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 474,
"end": 483,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 474,
"end": 483,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 475,
"end": 483,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 477,
"end": 483,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 454,
"end": 561,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 485,
"end": 561,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 499,
"end": 551,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 503,
"end": 508,
"ctxt": 0
},
"value": "debug",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 510,
"end": 551,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 528,
"end": 537,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 528,
"end": 536,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 528,
"end": 533,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 534,
"end": 535,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 571,
"end": 757,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 587,
"end": 593,
"ctxt": 0
},
"value": "assert",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 594,
"end": 612,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 594,
"end": 612,
"ctxt": 0
},
"value": "condition",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 603,
"end": 612,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 605,
"end": 612,
"ctxt": 0
},
"kind": "boolean"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 614,
"end": 623,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 614,
"end": 623,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 615,
"end": 623,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 617,
"end": 623,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 578,
"end": 757,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 625,
"end": 757,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 639,
"end": 747,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 643,
"end": 648,
"ctxt": 0
},
"value": "debug",
"optional": false
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 650,
"end": 747,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 668,
"end": 733,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 672,
"end": 682,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "Identifier",
"span": {
"start": 673,
"end": 682,
"ctxt": 0
},
"value": "condition",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 684,
"end": 733,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 706,
"end": 715,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 706,
"end": 714,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 706,
"end": 711,
"ctxt": 0
},
"value": "Alert",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 712,
"end": 713,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
],
"interpreter": null
}