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

1148 lines
33 KiB
JSON

{
"type": "Script",
"span": {
"start": 24,
"end": 688,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 24,
"end": 209,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "X",
"optional": false
},
"body": {
"type": "TsNamespaceDeclaration",
"span": {
"start": 33,
"end": 209,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 35,
"end": 209,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 41,
"end": 207,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 54,
"end": 59,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"declare": false,
"span": {
"start": 48,
"end": 207,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 70,
"end": 163,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 70,
"end": 81,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 82,
"end": 91,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 82,
"end": 91,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 91,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 93,
"end": 102,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 93,
"end": 102,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 94,
"end": 102,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 96,
"end": 102,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 104,
"end": 163,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 118,
"end": 129,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 118,
"end": 128,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 118,
"end": 124,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 118,
"end": 122,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 142,
"end": 152,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 142,
"end": 148,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 142,
"end": 146,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassProperty",
"span": {
"start": 172,
"end": 182,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 173,
"end": 181,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 175,
"end": 181,
"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": 191,
"end": 201,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 192,
"end": 200,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 194,
"end": 200,
"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": 235,
"end": 326,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "X",
"optional": false
},
"body": {
"type": "TsNamespaceDeclaration",
"span": {
"start": 244,
"end": 326,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 246,
"end": 326,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 252,
"end": 324,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 259,
"end": 324,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 266,
"end": 271,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 272,
"end": 324,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 282,
"end": 318,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 289,
"end": 318,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 293,
"end": 317,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 293,
"end": 299,
"ctxt": 0
},
"value": "Origin",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 302,
"end": 317,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 306,
"end": 311,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 315,
"end": 316,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
}
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 386,
"end": 414,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 390,
"end": 413,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 390,
"end": 392,
"ctxt": 0
},
"value": "cl",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 395,
"end": 413,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 399,
"end": 408,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 399,
"end": 402,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 399,
"end": 400,
"ctxt": 0
},
"value": "X",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 401,
"end": 402,
"ctxt": 0
},
"value": "Y",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 403,
"end": 408,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 409,
"end": 410,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 411,
"end": 412,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 415,
"end": 441,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 419,
"end": 440,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 419,
"end": 421,
"ctxt": 0
},
"value": "cl",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 424,
"end": 440,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 424,
"end": 433,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 424,
"end": 427,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 424,
"end": 425,
"ctxt": 0
},
"value": "X",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 426,
"end": 427,
"ctxt": 0
},
"value": "Y",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 428,
"end": 433,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 434,
"end": 440,
"ctxt": 0
},
"value": "Origin",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 521,
"end": 522,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 515,
"end": 542,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 529,
"end": 540,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 529,
"end": 531,
"ctxt": 0
},
"value": "id",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 531,
"end": 539,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 533,
"end": 539,
"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": []
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 544,
"end": 591,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 551,
"end": 552,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 553,
"end": 591,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 559,
"end": 589,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 566,
"end": 589,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 570,
"end": 588,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 570,
"end": 578,
"ctxt": 0
},
"value": "Instance",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 581,
"end": 588,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 585,
"end": 586,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 629,
"end": 648,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 633,
"end": 647,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 633,
"end": 634,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 637,
"end": 647,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 637,
"end": 638,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 639,
"end": 647,
"ctxt": 0
},
"value": "Instance",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 649,
"end": 665,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 653,
"end": 664,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 657,
"end": 664,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 661,
"end": 662,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 666,
"end": 688,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 670,
"end": 687,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 670,
"end": 671,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 671,
"end": 687,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 673,
"end": 687,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 675,
"end": 685,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 675,
"end": 677,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 677,
"end": 685,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 679,
"end": 685,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}