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

828 lines
20 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 98,
"end": 441,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 115,
"end": 122,
"ctxt": 0
},
"value": "require",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 123,
"end": 133,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 123,
"end": 133,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 133,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 98,
"end": 140,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 134,
"end": 139,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 136,
"end": 139,
"ctxt": 0
},
"kind": "any"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 141,
"end": 179,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 153,
"end": 164,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"value": "module",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 159,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 161,
"end": 164,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 166,
"end": 178,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 166,
"end": 173,
"ctxt": 0
},
"value": "exports",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 173,
"end": 178,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 204,
"end": 233,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 210,
"end": 232,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": "A",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 214,
"end": 232,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 214,
"end": 221,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 222,
"end": 231,
"ctxt": 0
},
"value": "./other",
"raw": "\"./other\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 234,
"end": 255,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 240,
"end": 254,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 244,
"end": 254,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 244,
"end": 251,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 252,
"end": 254,
"ctxt": 0
},
"value": "id",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 257,
"end": 294,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 263,
"end": 294,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "B",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 267,
"end": 294,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 278,
"end": 294,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 280,
"end": 292,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 280,
"end": 291,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 280,
"end": 287,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 280,
"end": 284,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 285,
"end": 287,
"ctxt": 0
},
"value": "id",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": 1.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 295,
"end": 337,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 295,
"end": 337,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 295,
"end": 308,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 295,
"end": 306,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 297,
"end": 306,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 311,
"end": 337,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 322,
"end": 337,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 324,
"end": 335,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 324,
"end": 334,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 324,
"end": 330,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 324,
"end": 328,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": 2.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 338,
"end": 356,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 344,
"end": 355,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 344,
"end": 345,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 348,
"end": 355,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": "B",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 357,
"end": 362,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 357,
"end": 361,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 357,
"end": 358,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 359,
"end": 361,
"ctxt": 0
},
"value": "id",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 363,
"end": 367,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 363,
"end": 366,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 401,
"end": 402,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 392,
"end": 421,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 405,
"end": 421,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 407,
"end": 419,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 407,
"end": 418,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 407,
"end": 414,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 407,
"end": 411,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 412,
"end": 414,
"ctxt": 0
},
"value": "id",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 417,
"end": 418,
"ctxt": 0
},
"value": 1.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 422,
"end": 441,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 422,
"end": 440,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 422,
"end": 436,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 422,
"end": 428,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 429,
"end": 436,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
],
"interpreter": null
}