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

3115 lines
82 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 29,
"end": 1515,
"ctxt": 0
},
"body": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 29,
"end": 70,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 34,
"end": 35,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 38,
"end": 70,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 42,
"end": 52,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 42,
"end": 46,
"ctxt": 0
},
"value": "type",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"value": "A",
"raw": "'A'"
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 55,
"end": 68,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 55,
"end": 59,
"ctxt": 0
},
"value": "name",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 59,
"end": 67,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 72,
"end": 97,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 81,
"end": 97,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 85,
"end": 95,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 85,
"end": 89,
"ctxt": 0
},
"value": "type",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 89,
"end": 94,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 91,
"end": 94,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 91,
"end": 94,
"ctxt": 0
},
"value": "B",
"raw": "'B'"
}
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 108,
"end": 115,
"ctxt": 0
},
"value": "funcTwo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 116,
"end": 138,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 116,
"end": 138,
"ctxt": 0
},
"value": "arg",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 138,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 121,
"end": 138,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 129,
"end": 138,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 99,
"end": 223,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 140,
"end": 223,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 144,
"end": 200,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 148,
"end": 165,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"questionDotToken": {
"start": 151,
"end": 152,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 148,
"end": 151,
"ctxt": 0
},
"value": "arg",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 153,
"end": 157,
"ctxt": 0
},
"value": "type",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "B",
"raw": "'B'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 167,
"end": 200,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 173,
"end": 177,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"value": "arg",
"optional": false
}
},
{
"type": "ReturnStatement",
"span": {
"start": 189,
"end": 196,
"ctxt": 0
},
"argument": null
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 204,
"end": 208,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 204,
"end": 207,
"ctxt": 0
},
"value": "arg",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 211,
"end": 221,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 211,
"end": 220,
"ctxt": 0
},
"questionDotToken": {
"start": 214,
"end": 215,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 211,
"end": 220,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"value": "arg",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 216,
"end": 220,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 234,
"end": 243,
"ctxt": 0
},
"value": "funcThree",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 244,
"end": 261,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 244,
"end": 261,
"ctxt": 0
},
"value": "arg",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 247,
"end": 261,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 249,
"end": 261,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 253,
"end": 254,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 253,
"end": 254,
"ctxt": 0
},
"value": "B",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 257,
"end": 261,
"ctxt": 0
},
"kind": "null"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 225,
"end": 346,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 263,
"end": 346,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 267,
"end": 323,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 271,
"end": 288,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 271,
"end": 280,
"ctxt": 0
},
"questionDotToken": {
"start": 274,
"end": 275,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 271,
"end": 280,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 271,
"end": 274,
"ctxt": 0
},
"value": "arg",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 276,
"end": 280,
"ctxt": 0
},
"value": "type",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 285,
"end": 288,
"ctxt": 0
},
"value": "B",
"raw": "'B'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 290,
"end": 323,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 296,
"end": 300,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 296,
"end": 299,
"ctxt": 0
},
"value": "arg",
"optional": false
}
},
{
"type": "ReturnStatement",
"span": {
"start": 312,
"end": 319,
"ctxt": 0
},
"argument": null
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 327,
"end": 330,
"ctxt": 0
},
"value": "arg",
"optional": false
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 334,
"end": 344,
"ctxt": 0
},
"expression": {
"type": "OptionalChainingExpression",
"span": {
"start": 334,
"end": 343,
"ctxt": 0
},
"questionDotToken": {
"start": 337,
"end": 338,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 334,
"end": 343,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 334,
"end": 337,
"ctxt": 0
},
"value": "arg",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 339,
"end": 343,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 348,
"end": 384,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 357,
"end": 384,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 359,
"end": 375,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 359,
"end": 363,
"ctxt": 0
},
"value": "kind",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 363,
"end": 374,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 365,
"end": 374,
"ctxt": 0
},
"kind": "undefined"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 376,
"end": 382,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 376,
"end": 377,
"ctxt": 0
},
"value": "u",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 377,
"end": 382,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 379,
"end": 382,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 379,
"end": 382,
"ctxt": 0
},
"value": "u",
"raw": "'u'"
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 385,
"end": 416,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"value": "N",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 394,
"end": 416,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 396,
"end": 407,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 396,
"end": 400,
"ctxt": 0
},
"value": "kind",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 400,
"end": 406,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 402,
"end": 406,
"ctxt": 0
},
"kind": "null"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 408,
"end": 414,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 408,
"end": 409,
"ctxt": 0
},
"value": "n",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 409,
"end": 414,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 411,
"end": 414,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 411,
"end": 414,
"ctxt": 0
},
"value": "n",
"raw": "'n'"
}
}
},
"typeParams": null
}
]
}
},
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 417,
"end": 447,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 426,
"end": 447,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 428,
"end": 438,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 428,
"end": 432,
"ctxt": 0
},
"value": "kind",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 432,
"end": 437,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 434,
"end": 437,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 434,
"end": 437,
"ctxt": 0
},
"value": "X",
"raw": "'X'"
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 439,
"end": 445,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 440,
"end": 445,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 442,
"end": 445,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 442,
"end": 445,
"ctxt": 0
},
"value": "x",
"raw": "'x'"
}
}
},
"typeParams": null
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 458,
"end": 460,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 461,
"end": 481,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 461,
"end": 481,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 462,
"end": 481,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 464,
"end": 481,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 468,
"end": 469,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 472,
"end": 481,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 449,
"end": 586,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 483,
"end": 586,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 489,
"end": 584,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 493,
"end": 514,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 493,
"end": 500,
"ctxt": 0
},
"questionDotToken": {
"start": 494,
"end": 495,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 493,
"end": 500,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 493,
"end": 494,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 496,
"end": 500,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 505,
"end": 514,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 516,
"end": 551,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 526,
"end": 528,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 526,
"end": 527,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 561,
"end": 584,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 571,
"end": 573,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 571,
"end": 572,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 597,
"end": 599,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 600,
"end": 620,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 600,
"end": 620,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 601,
"end": 620,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 603,
"end": 620,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 603,
"end": 604,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 603,
"end": 604,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 607,
"end": 608,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 607,
"end": 608,
"ctxt": 0
},
"value": "N",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 611,
"end": 620,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 588,
"end": 725,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 622,
"end": 725,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 628,
"end": 723,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 632,
"end": 653,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 632,
"end": 639,
"ctxt": 0
},
"questionDotToken": {
"start": 633,
"end": 634,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 632,
"end": 639,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 632,
"end": 633,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 635,
"end": 639,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 644,
"end": 653,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 655,
"end": 686,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 665,
"end": 667,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 665,
"end": 666,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 696,
"end": 723,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 706,
"end": 708,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 706,
"end": 707,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 736,
"end": 738,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 739,
"end": 754,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 739,
"end": 754,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 740,
"end": 754,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 742,
"end": 754,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 742,
"end": 743,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 742,
"end": 743,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 746,
"end": 747,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 746,
"end": 747,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 750,
"end": 754,
"ctxt": 0
},
"kind": "null"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 727,
"end": 854,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 756,
"end": 854,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 762,
"end": 852,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 766,
"end": 787,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 766,
"end": 773,
"ctxt": 0
},
"questionDotToken": {
"start": 767,
"end": 768,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 766,
"end": 773,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 766,
"end": 767,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 769,
"end": 773,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 778,
"end": 787,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 789,
"end": 819,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 799,
"end": 801,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 799,
"end": 800,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 829,
"end": 852,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 839,
"end": 841,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 839,
"end": 840,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 865,
"end": 867,
"ctxt": 0
},
"value": "f4",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 868,
"end": 883,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 868,
"end": 883,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 869,
"end": 883,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 871,
"end": 883,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 871,
"end": 872,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 871,
"end": 872,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 875,
"end": 876,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 875,
"end": 876,
"ctxt": 0
},
"value": "N",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 879,
"end": 883,
"ctxt": 0
},
"kind": "null"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 856,
"end": 983,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 885,
"end": 983,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 891,
"end": 981,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 895,
"end": 916,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 895,
"end": 902,
"ctxt": 0
},
"questionDotToken": {
"start": 896,
"end": 897,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 895,
"end": 902,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 895,
"end": 896,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 898,
"end": 902,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 907,
"end": 916,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 918,
"end": 944,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 928,
"end": 930,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 928,
"end": 929,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 954,
"end": 981,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 964,
"end": 966,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 964,
"end": 965,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 994,
"end": 996,
"ctxt": 0
},
"value": "f5",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 997,
"end": 1017,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 997,
"end": 1017,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 998,
"end": 1017,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1000,
"end": 1017,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1000,
"end": 1001,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1004,
"end": 1005,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1004,
"end": 1005,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 1008,
"end": 1017,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 985,
"end": 1125,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1019,
"end": 1125,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 1025,
"end": 1123,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 1029,
"end": 1045,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 1029,
"end": 1036,
"ctxt": 0
},
"questionDotToken": {
"start": 1030,
"end": 1031,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 1029,
"end": 1036,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1029,
"end": 1030,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1032,
"end": 1036,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 1041,
"end": 1045,
"ctxt": 0
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 1047,
"end": 1074,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1057,
"end": 1059,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1057,
"end": 1058,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 1084,
"end": 1123,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1094,
"end": 1096,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1094,
"end": 1095,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1136,
"end": 1138,
"ctxt": 0
},
"value": "f6",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 1139,
"end": 1159,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1139,
"end": 1159,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1140,
"end": 1159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1142,
"end": 1159,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1142,
"end": 1143,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1142,
"end": 1143,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1146,
"end": 1147,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1146,
"end": 1147,
"ctxt": 0
},
"value": "N",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 1150,
"end": 1159,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 1127,
"end": 1259,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1161,
"end": 1259,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 1167,
"end": 1257,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 1171,
"end": 1187,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 1171,
"end": 1178,
"ctxt": 0
},
"questionDotToken": {
"start": 1172,
"end": 1173,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 1171,
"end": 1178,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1171,
"end": 1172,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1174,
"end": 1178,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 1183,
"end": 1187,
"ctxt": 0
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 1189,
"end": 1212,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1199,
"end": 1201,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1199,
"end": 1200,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 1222,
"end": 1257,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1232,
"end": 1234,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1232,
"end": 1233,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1270,
"end": 1272,
"ctxt": 0
},
"value": "f7",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 1273,
"end": 1288,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1273,
"end": 1288,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1274,
"end": 1288,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1276,
"end": 1288,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1276,
"end": 1277,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1276,
"end": 1277,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1280,
"end": 1281,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1280,
"end": 1281,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 1284,
"end": 1288,
"ctxt": 0
},
"kind": "null"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 1261,
"end": 1391,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1290,
"end": 1391,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 1296,
"end": 1389,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 1300,
"end": 1316,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 1300,
"end": 1307,
"ctxt": 0
},
"questionDotToken": {
"start": 1301,
"end": 1302,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 1300,
"end": 1307,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1300,
"end": 1301,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1303,
"end": 1307,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 1312,
"end": 1316,
"ctxt": 0
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 1318,
"end": 1345,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1328,
"end": 1330,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1328,
"end": 1329,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 1355,
"end": 1389,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1365,
"end": 1367,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1365,
"end": 1366,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1402,
"end": 1404,
"ctxt": 0
},
"value": "f8",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 1405,
"end": 1420,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1405,
"end": 1420,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1406,
"end": 1420,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1408,
"end": 1420,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1408,
"end": 1409,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1408,
"end": 1409,
"ctxt": 0
},
"value": "X",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1412,
"end": 1413,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1412,
"end": 1413,
"ctxt": 0
},
"value": "N",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 1416,
"end": 1420,
"ctxt": 0
},
"kind": "null"
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 1393,
"end": 1515,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1422,
"end": 1515,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 1428,
"end": 1513,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 1432,
"end": 1448,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "OptionalChainingExpression",
"span": {
"start": 1432,
"end": 1439,
"ctxt": 0
},
"questionDotToken": {
"start": 1433,
"end": 1434,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 1432,
"end": 1439,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1432,
"end": 1433,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1435,
"end": 1439,
"ctxt": 0
},
"value": "kind",
"optional": false
}
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 1444,
"end": 1448,
"ctxt": 0
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 1450,
"end": 1473,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1460,
"end": 1462,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1460,
"end": 1461,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 1483,
"end": 1513,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 1493,
"end": 1495,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1493,
"end": 1494,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}