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

853 lines
20 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 142,
"end": 455,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 142,
"end": 174,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 156,
"end": 174,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 162,
"end": 172,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 162,
"end": 172,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 162,
"end": 168,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 162,
"end": 166,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 175,
"end": 221,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 175,
"end": 221,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 175,
"end": 188,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 175,
"end": 186,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 177,
"end": 186,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 191,
"end": 221,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 202,
"end": 221,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 208,
"end": 219,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 208,
"end": 219,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 208,
"end": 214,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 208,
"end": 212,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 217,
"end": 219,
"ctxt": 0
},
"value": 12.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 222,
"end": 238,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 226,
"end": 238,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 230,
"end": 238,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": 1.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 239,
"end": 254,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 239,
"end": 254,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 239,
"end": 242,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 245,
"end": 254,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 271,
"end": 286,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 271,
"end": 286,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 271,
"end": 274,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 271,
"end": 272,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 277,
"end": 286,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 319,
"end": 413,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 333,
"end": 413,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 339,
"end": 396,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 343,
"end": 363,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 344,
"end": 363,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 345,
"end": 362,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "ThisExpression",
"span": {
"start": 345,
"end": 349,
"ctxt": 0
}
},
"right": {
"type": "Identifier",
"span": {
"start": 361,
"end": 362,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 365,
"end": 396,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 375,
"end": 390,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 382,
"end": 390,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 386,
"end": 387,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 388,
"end": 389,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 401,
"end": 411,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 401,
"end": 411,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 401,
"end": 407,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 401,
"end": 405,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 406,
"end": 407,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 410,
"end": 411,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 414,
"end": 426,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 418,
"end": 426,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 418,
"end": 419,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 422,
"end": 426,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 424,
"end": 425,
"ctxt": 0
},
"value": 1.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 427,
"end": 443,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 431,
"end": 443,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 431,
"end": 432,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 435,
"end": 443,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 441,
"end": 442,
"ctxt": 0
},
"value": 2.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 444,
"end": 455,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 444,
"end": 455,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 444,
"end": 447,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 444,
"end": 445,
"ctxt": 0
},
"value": "k",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 446,
"end": 447,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 452,
"end": 455,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 452,
"end": 453,
"ctxt": 0
},
"value": "j",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 454,
"end": 455,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
}
],
"interpreter": null
}