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

734 lines
23 KiB
JSON

{
"type": "Script",
"span": {
"start": 25,
"end": 485,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 25,
"end": 116,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "X",
"optional": false
},
"body": {
"type": "TsNamespaceDeclaration",
"span": {
"start": 34,
"end": 116,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 34,
"end": 35,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 36,
"end": 116,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 42,
"end": 114,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 49,
"end": 114,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 62,
"end": 114,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 72,
"end": 108,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 79,
"end": 108,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 83,
"end": 107,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 83,
"end": 89,
"ctxt": 0
},
"value": "Origin",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 92,
"end": 107,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 96,
"end": 101,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
}
}
]
}
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 146,
"end": 359,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "X",
"optional": false
},
"body": {
"type": "TsNamespaceDeclaration",
"span": {
"start": 155,
"end": 359,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 157,
"end": 359,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 191,
"end": 357,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 204,
"end": 209,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"declare": false,
"span": {
"start": 198,
"end": 357,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 220,
"end": 313,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 220,
"end": 231,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 232,
"end": 241,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 232,
"end": 241,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 233,
"end": 241,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 235,
"end": 241,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 243,
"end": 252,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 243,
"end": 252,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 244,
"end": 252,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 246,
"end": 252,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 254,
"end": 313,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 268,
"end": 279,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 268,
"end": 278,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 268,
"end": 274,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 268,
"end": 272,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 292,
"end": 303,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 292,
"end": 302,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 292,
"end": 298,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 292,
"end": 296,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassProperty",
"span": {
"start": 322,
"end": 332,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 323,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 341,
"end": 351,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 341,
"end": 342,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 342,
"end": 350,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 344,
"end": 350,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
}
]
}
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 385,
"end": 432,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 392,
"end": 393,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 394,
"end": 432,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 400,
"end": 430,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 407,
"end": 430,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 411,
"end": 429,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 411,
"end": 419,
"ctxt": 0
},
"value": "Instance",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 422,
"end": 429,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 426,
"end": 427,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 458,
"end": 485,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 472,
"end": 483,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 472,
"end": 474,
"ctxt": 0
},
"value": "id",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 474,
"end": 482,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 476,
"end": 482,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}