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

1148 lines
33 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 40,
"end": 704,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 40,
"end": 225,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 47,
"end": 48,
"ctxt": 0
},
"value": "X",
"optional": false
},
"body": {
"type": "TsNamespaceDeclaration",
"span": {
"start": 49,
"end": 225,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 51,
"end": 225,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 57,
"end": 223,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 70,
"end": 75,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"declare": false,
"span": {
"start": 64,
"end": 223,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 86,
"end": 179,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 86,
"end": 97,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 98,
"end": 107,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 98,
"end": 107,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 99,
"end": 107,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 101,
"end": 107,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 109,
"end": 118,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 109,
"end": 118,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 112,
"end": 118,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 120,
"end": 179,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 134,
"end": 145,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 134,
"end": 144,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 134,
"end": 140,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 134,
"end": 138,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 158,
"end": 169,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 158,
"end": 168,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 158,
"end": 164,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 158,
"end": 162,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassProperty",
"span": {
"start": 188,
"end": 198,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 189,
"end": 197,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 191,
"end": 197,
"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": 207,
"end": 217,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 208,
"end": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 210,
"end": 216,
"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": 251,
"end": 342,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 258,
"end": 259,
"ctxt": 0
},
"value": "X",
"optional": false
},
"body": {
"type": "TsNamespaceDeclaration",
"span": {
"start": 260,
"end": 342,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 262,
"end": 342,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 268,
"end": 340,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 275,
"end": 340,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 282,
"end": 287,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 288,
"end": 340,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 298,
"end": 334,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 305,
"end": 334,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 309,
"end": 333,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 309,
"end": 315,
"ctxt": 0
},
"value": "Origin",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 318,
"end": 333,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 322,
"end": 327,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
}
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 402,
"end": 430,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 406,
"end": 429,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 406,
"end": 408,
"ctxt": 0
},
"value": "cl",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 411,
"end": 429,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 415,
"end": 424,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 415,
"end": 418,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 415,
"end": 416,
"ctxt": 0
},
"value": "X",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 417,
"end": 418,
"ctxt": 0
},
"value": "Y",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 419,
"end": 424,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 425,
"end": 426,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 427,
"end": 428,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 431,
"end": 457,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 435,
"end": 456,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 435,
"end": 437,
"ctxt": 0
},
"value": "cl",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 440,
"end": 456,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 440,
"end": 449,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 440,
"end": 443,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 440,
"end": 441,
"ctxt": 0
},
"value": "X",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 442,
"end": 443,
"ctxt": 0
},
"value": "Y",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 444,
"end": 449,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 450,
"end": 456,
"ctxt": 0
},
"value": "Origin",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 537,
"end": 538,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 531,
"end": 558,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 545,
"end": 556,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 545,
"end": 547,
"ctxt": 0
},
"value": "id",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 547,
"end": 555,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 549,
"end": 555,
"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": 560,
"end": 607,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 567,
"end": 568,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 569,
"end": 607,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 575,
"end": 605,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 582,
"end": 605,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 586,
"end": 604,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 586,
"end": 594,
"ctxt": 0
},
"value": "Instance",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 597,
"end": 604,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 601,
"end": 602,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 645,
"end": 664,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 649,
"end": 663,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 649,
"end": 650,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 653,
"end": 663,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 655,
"end": 663,
"ctxt": 0
},
"value": "Instance",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 665,
"end": 681,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 669,
"end": 680,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 669,
"end": 670,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 673,
"end": 680,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 677,
"end": 678,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 682,
"end": 704,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 686,
"end": 703,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 686,
"end": 687,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 687,
"end": 703,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 689,
"end": 703,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 691,
"end": 701,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 691,
"end": 693,
"ctxt": 0
},
"value": "id",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 693,
"end": 701,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 695,
"end": 701,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}