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

831 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 99,
"end": 442,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 116,
"end": 123,
"ctxt": 0
},
"value": "require",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 124,
"end": 134,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 124,
"end": 134,
"ctxt": 0
},
"value": "id",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 126,
"end": 134,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 128,
"end": 134,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 99,
"end": 141,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 135,
"end": 140,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 137,
"end": 140,
"ctxt": 0
},
"kind": "any"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 142,
"end": 180,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 154,
"end": 165,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"value": "module",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 160,
"end": 165,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 167,
"end": 179,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 174,
"ctxt": 0
},
"value": "exports",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 174,
"end": 179,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 176,
"end": 179,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 205,
"end": 234,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 211,
"end": 233,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "A",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 215,
"end": 233,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 215,
"end": 222,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 223,
"end": 232,
"ctxt": 0
},
"value": "./other",
"raw": "\"./other\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 235,
"end": 256,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 241,
"end": 255,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 245,
"end": 255,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 245,
"end": 252,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 253,
"end": 255,
"ctxt": 0
},
"value": "id",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 258,
"end": 295,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 264,
"end": 295,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "B",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 268,
"end": 295,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 279,
"end": 295,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 281,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 281,
"end": 292,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 281,
"end": 288,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 281,
"end": 285,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 286,
"end": 288,
"ctxt": 0
},
"value": "id",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 296,
"end": 338,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 296,
"end": 338,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 296,
"end": 309,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 296,
"end": 307,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 296,
"end": 297,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 298,
"end": 307,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 308,
"end": 309,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 312,
"end": 338,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 323,
"end": 338,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 325,
"end": 336,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 325,
"end": 335,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 325,
"end": 329,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 339,
"end": 357,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 345,
"end": 356,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 345,
"end": 346,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 349,
"end": 356,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "B",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 358,
"end": 363,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 358,
"end": 362,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 360,
"end": 362,
"ctxt": 0
},
"value": "id",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 364,
"end": 368,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 364,
"end": 367,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 364,
"end": 365,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 402,
"end": 403,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 393,
"end": 422,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 406,
"end": 422,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 408,
"end": 420,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 408,
"end": 419,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 408,
"end": 415,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 408,
"end": 412,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 413,
"end": 415,
"ctxt": 0
},
"value": "id",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 418,
"end": 419,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 423,
"end": 442,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 423,
"end": 441,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 423,
"end": 437,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 423,
"end": 429,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 430,
"end": 437,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 440,
"end": 441,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
],
"interpreter": null
}