swc/crates/swc_ecma_parser/tests/tsc/assignmentCompatWithConstructSignatures.json
2022-02-04 20:17:42 +09:00

1522 lines
37 KiB
JSON

{
"type": "Script",
"span": {
"start": 110,
"end": 594,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 110,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": "T",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 122,
"end": 152,
"ctxt": 0
},
"body": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
"start": 128,
"end": 150,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 133,
"end": 142,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 134,
"end": 142,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 136,
"end": 142,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 145,
"end": 149,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 153,
"end": 162,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 157,
"end": 161,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 157,
"end": 158,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 158,
"end": 161,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 163,
"end": 196,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 167,
"end": 195,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 168,
"end": 195,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 170,
"end": 195,
"ctxt": 0
},
"members": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
"start": 172,
"end": 193,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 177,
"end": 186,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 178,
"end": 186,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 180,
"end": 186,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 187,
"end": 193,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 189,
"end": 193,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 198,
"end": 204,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 198,
"end": 203,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 205,
"end": 211,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 205,
"end": 210,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "t",
"optional": false
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 213,
"end": 257,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 223,
"end": 224,
"ctxt": 0
},
"value": "S",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 225,
"end": 257,
"ctxt": 0
},
"body": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
"start": 231,
"end": 255,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 236,
"end": 245,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 237,
"end": 245,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 239,
"end": 245,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 246,
"end": 254,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 248,
"end": 254,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 258,
"end": 267,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 262,
"end": 266,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 262,
"end": 263,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 263,
"end": 266,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": "S",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 268,
"end": 304,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 272,
"end": 303,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 272,
"end": 274,
"ctxt": 0
},
"value": "a2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 274,
"end": 303,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 276,
"end": 303,
"ctxt": 0
},
"members": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
"start": 278,
"end": 301,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 283,
"end": 292,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 284,
"end": 292,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 286,
"end": 292,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 293,
"end": 301,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 295,
"end": 301,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 305,
"end": 311,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 305,
"end": 310,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 312,
"end": 319,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 312,
"end": 318,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"value": "a2",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 320,
"end": 326,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 320,
"end": 325,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 320,
"end": 321,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 327,
"end": 334,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 327,
"end": 333,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 331,
"end": 333,
"ctxt": 0
},
"value": "a2",
"optional": false
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 336,
"end": 375,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 346,
"end": 348,
"ctxt": 0
},
"value": "S2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 349,
"end": 375,
"ctxt": 0
},
"body": [
{
"type": "TsCallSignatureDeclaration",
"span": {
"start": 355,
"end": 373,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 356,
"end": 365,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 357,
"end": 365,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 359,
"end": 365,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 366,
"end": 372,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 368,
"end": 372,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 376,
"end": 387,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 380,
"end": 386,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 380,
"end": 382,
"ctxt": 0
},
"value": "s2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 382,
"end": 386,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 384,
"end": 386,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 384,
"end": 386,
"ctxt": 0
},
"value": "S2",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 388,
"end": 418,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 392,
"end": 417,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 392,
"end": 394,
"ctxt": 0
},
"value": "a3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 394,
"end": 417,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 396,
"end": 417,
"ctxt": 0
},
"members": [
{
"type": "TsCallSignatureDeclaration",
"span": {
"start": 398,
"end": 415,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 399,
"end": 408,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 400,
"end": 408,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 402,
"end": 408,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 409,
"end": 415,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 411,
"end": 415,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 439,
"end": 446,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 439,
"end": 445,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 443,
"end": 445,
"ctxt": 0
},
"value": "s2",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 447,
"end": 454,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 447,
"end": 453,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 447,
"end": 448,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 451,
"end": 453,
"ctxt": 0
},
"value": "a3",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 455,
"end": 476,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 455,
"end": 475,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 459,
"end": 475,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 460,
"end": 469,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 461,
"end": 469,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 463,
"end": 469,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"body": {
"type": "NumericLiteral",
"span": {
"start": 474,
"end": 475,
"ctxt": 0
},
"value": 1.0
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 477,
"end": 516,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 477,
"end": 516,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 477,
"end": 478,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 491,
"end": 500,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 491,
"end": 500,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 492,
"end": 500,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 494,
"end": 500,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 481,
"end": 516,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 502,
"end": 516,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 504,
"end": 514,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 511,
"end": 513,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 517,
"end": 524,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 517,
"end": 523,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 517,
"end": 518,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 521,
"end": 523,
"ctxt": 0
},
"value": "s2",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 525,
"end": 532,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 525,
"end": 531,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 525,
"end": 526,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 529,
"end": 531,
"ctxt": 0
},
"value": "a3",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 533,
"end": 554,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 533,
"end": 553,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 533,
"end": 534,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 537,
"end": 553,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 538,
"end": 547,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 539,
"end": 547,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 541,
"end": 547,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"body": {
"type": "NumericLiteral",
"span": {
"start": 552,
"end": 553,
"ctxt": 0
},
"value": 1.0
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 555,
"end": 594,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 555,
"end": 594,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 555,
"end": 556,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 569,
"end": 578,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 569,
"end": 578,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 570,
"end": 578,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 572,
"end": 578,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 559,
"end": 594,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 580,
"end": 594,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 582,
"end": 592,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 589,
"end": 591,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
}
],
"interpreter": null
}