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

390 lines
9.5 KiB
JSON

{
"type": "Module",
"span": {
"start": 54,
"end": 344,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 54,
"end": 80,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 61,
"end": 80,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 65,
"end": 79,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 66,
"end": 74,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 77,
"end": 79,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 105,
"end": 163,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "StringLiteral",
"span": {
"start": 120,
"end": 130,
"ctxt": 0
},
"value": "vs/foo_0",
"raw": "\"vs/foo_0\""
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 131,
"end": 163,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 134,
"end": 161,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 141,
"end": 161,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 145,
"end": 160,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 145,
"end": 146,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 146,
"end": 160,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 148,
"end": 160,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 151,
"end": 160,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"kind": "number"
}
}
}
}
},
"init": null,
"definite": false
}
]
}
}
]
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 222,
"end": 255,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 229,
"end": 232,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 235,
"end": 254,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 243,
"end": 253,
"ctxt": 0
},
"value": "vs/foo_0",
"raw": "\"vs/foo_0\""
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 256,
"end": 276,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 260,
"end": 275,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 260,
"end": 262,
"ctxt": 0
},
"value": "z1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 265,
"end": 275,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 265,
"end": 270,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 265,
"end": 268,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 273,
"end": 275,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 322,
"end": 344,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 326,
"end": 343,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 326,
"end": 328,
"ctxt": 0
},
"value": "z2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 331,
"end": 343,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "CallExpression",
"span": {
"start": 331,
"end": 338,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 331,
"end": 336,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 331,
"end": 334,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 335,
"end": 336,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 341,
"end": 343,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
},
"definite": false
}
]
}
],
"interpreter": null
}