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

1035 lines
30 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 618,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 1,
"end": 146,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"value": "A",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 10,
"end": 146,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 16,
"end": 102,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 29,
"end": 34,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"declare": false,
"span": {
"start": 23,
"end": 102,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 45,
"end": 96,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 45,
"end": 56,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 57,
"end": 73,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 64,
"end": 73,
"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"
}
}
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 75,
"end": 91,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 82,
"end": 91,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 91,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 108,
"end": 144,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 144,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 119,
"end": 143,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 119,
"end": 125,
"ctxt": 0
},
"value": "Origin",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 128,
"end": 143,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 141,
"end": 142,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 172,
"end": 250,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "B",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 181,
"end": 250,
"ctxt": 0
},
"body": [
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 187,
"end": 200,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "a",
"optional": false
},
"moduleRef": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 276,
"end": 420,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "C",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 285,
"end": 420,
"ctxt": 0
},
"body": [
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 291,
"end": 304,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "a",
"optional": false
},
"moduleRef": {
"type": "Identifier",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "A",
"optional": false
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 357,
"end": 373,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 361,
"end": 372,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 361,
"end": 362,
"ctxt": 0
},
"value": "m",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 362,
"end": 372,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 364,
"end": 372,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 371,
"end": 372,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeArguments": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 378,
"end": 393,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 382,
"end": 392,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 382,
"end": 383,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 383,
"end": 392,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 385,
"end": 392,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 387,
"end": 392,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 398,
"end": 418,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 402,
"end": 417,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 402,
"end": 403,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 406,
"end": 417,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 407,
"end": 408,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 409,
"end": 410,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 412,
"end": 413,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 414,
"end": 415,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
},
"definite": false
}
]
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 443,
"end": 505,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 450,
"end": 451,
"ctxt": 0
},
"value": "D",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 452,
"end": 505,
"ctxt": 0
},
"body": [
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 458,
"end": 471,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 465,
"end": 466,
"ctxt": 0
},
"value": "a",
"optional": false
},
"moduleRef": {
"type": "Identifier",
"span": {
"start": 469,
"end": 470,
"ctxt": 0
},
"value": "A",
"optional": false
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 477,
"end": 503,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 481,
"end": 502,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 485,
"end": 502,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 489,
"end": 496,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 489,
"end": 490,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 491,
"end": 496,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 507,
"end": 618,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": "E",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 516,
"end": 618,
"ctxt": 0
},
"body": [
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 522,
"end": 535,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 529,
"end": 530,
"ctxt": 0
},
"value": "a",
"optional": false
},
"moduleRef": {
"type": "Identifier",
"span": {
"start": 533,
"end": 534,
"ctxt": 0
},
"value": "A",
"optional": false
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 540,
"end": 616,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 556,
"end": 561,
"ctxt": 0
},
"value": "xDist",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 562,
"end": 572,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 562,
"end": 572,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 563,
"end": 572,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 565,
"end": 572,
"ctxt": 0
},
"typeName": {
"type": "TsQualifiedName",
"left": {
"type": "Identifier",
"span": {
"start": 565,
"end": 566,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 567,
"end": 572,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 547,
"end": 616,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 574,
"end": 616,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 584,
"end": 610,
"ctxt": 0
},
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 591,
"end": 609,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 592,
"end": 608,
"ctxt": 0
},
"operator": "-",
"left": {
"type": "MemberExpression",
"span": {
"start": 592,
"end": 602,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 592,
"end": 600,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 592,
"end": 593,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 594,
"end": 600,
"ctxt": 0
},
"value": "Origin",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 601,
"end": 602,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 605,
"end": 608,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 605,
"end": 606,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 607,
"end": 608,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
],
"interpreter": null
}