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

395 lines
9.6 KiB
JSON

{
"type": "Module",
"span": {
"start": 53,
"end": 343,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 53,
"end": 79,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 60,
"end": 79,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 64,
"end": 78,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 64,
"end": 65,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 65,
"end": 73,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 67,
"end": 73,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 76,
"end": 78,
"ctxt": 0
},
"value": 42.0
},
"definite": false
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 104,
"end": 162,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "StringLiteral",
"span": {
"start": 119,
"end": 129,
"ctxt": 0
},
"value": "vs/foo_0",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 130,
"end": 162,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 133,
"end": 160,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 140,
"end": 160,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 144,
"end": 159,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 145,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 147,
"end": 159,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 150,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"kind": "number"
}
}
}
}
},
"init": null,
"definite": false
}
]
}
}
]
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 221,
"end": 254,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 228,
"end": 231,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 234,
"end": 253,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 242,
"end": 252,
"ctxt": 0
},
"value": "vs/foo_0",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 255,
"end": 275,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 259,
"end": 274,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 259,
"end": 261,
"ctxt": 0
},
"value": "z1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 264,
"end": 274,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 264,
"end": 269,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 264,
"end": 267,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 272,
"end": 274,
"ctxt": 0
},
"value": 10.0
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 321,
"end": 343,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 325,
"end": 342,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 325,
"end": 327,
"ctxt": 0
},
"value": "z2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 330,
"end": 342,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "CallExpression",
"span": {
"start": 330,
"end": 337,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 330,
"end": 335,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 330,
"end": 333,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 340,
"end": 342,
"ctxt": 0
},
"value": 10.0
}
},
"definite": false
}
]
}
],
"interpreter": null
}