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

857 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 143,
"end": 456,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 152,
"end": 153,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 143,
"end": 175,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 157,
"end": 175,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 163,
"end": 173,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 163,
"end": 173,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 163,
"end": 169,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 163,
"end": 167,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 176,
"end": 222,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 176,
"end": 222,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 176,
"end": 189,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 176,
"end": 187,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 178,
"end": 187,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "m",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [],
"decorators": [],
"span": {
"start": 192,
"end": 222,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 203,
"end": 222,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 209,
"end": 220,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 209,
"end": 220,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 209,
"end": 215,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 209,
"end": 213,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 218,
"end": 220,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 223,
"end": 239,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 227,
"end": 239,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 231,
"end": 239,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 237,
"end": 238,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 240,
"end": 255,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 240,
"end": 255,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 240,
"end": 243,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 246,
"end": 255,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 272,
"end": 287,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 272,
"end": 287,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 272,
"end": 275,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 272,
"end": 273,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 274,
"end": 275,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 278,
"end": 287,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 320,
"end": 414,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 334,
"end": 414,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 340,
"end": 397,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 344,
"end": 364,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 345,
"end": 364,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 346,
"end": 363,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "ThisExpression",
"span": {
"start": 346,
"end": 350,
"ctxt": 0
}
},
"right": {
"type": "Identifier",
"span": {
"start": 362,
"end": 363,
"ctxt": 0
},
"value": "A",
"optional": false
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 366,
"end": 397,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 376,
"end": 391,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 383,
"end": 391,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 387,
"end": 388,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 389,
"end": 390,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 402,
"end": 412,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 402,
"end": 412,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 402,
"end": 408,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 402,
"end": 406,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 407,
"end": 408,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 411,
"end": 412,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 415,
"end": 427,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 419,
"end": 427,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 419,
"end": 420,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 423,
"end": 427,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 423,
"end": 424,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 425,
"end": 426,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 428,
"end": 444,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 432,
"end": 444,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 432,
"end": 433,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 436,
"end": 444,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 440,
"end": 441,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 442,
"end": 443,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 445,
"end": 456,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 445,
"end": 456,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 445,
"end": 448,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 445,
"end": 446,
"ctxt": 0
},
"value": "k",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 447,
"end": 448,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 453,
"end": 456,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 453,
"end": 454,
"ctxt": 0
},
"value": "j",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
}
],
"interpreter": null
}