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

1280 lines
31 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 703,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 1,
"end": 22,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 5,
"end": 21,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 5,
"end": 8,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 8,
"end": 16,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 10,
"end": 16,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 19,
"end": 21,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 33,
"end": 35,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 37,
"end": 46,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 37,
"end": 46,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 37,
"end": 40,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 24,
"end": 152,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 48,
"end": 152,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 101,
"end": 121,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 105,
"end": 120,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 105,
"end": 108,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 108,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 119,
"end": 120,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 126,
"end": 137,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 163,
"end": 165,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 167,
"end": 191,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 167,
"end": 191,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 167,
"end": 170,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 173,
"end": 191,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 174,
"end": 183,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 174,
"end": 177,
"ctxt": 0
},
"value": "baz",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 180,
"end": 183,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 188,
"end": 191,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 154,
"end": 299,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 193,
"end": 299,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 246,
"end": 266,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 250,
"end": 265,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 250,
"end": 253,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 253,
"end": 261,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 255,
"end": 261,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 271,
"end": 284,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 278,
"end": 283,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 278,
"end": 281,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 310,
"end": 312,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 314,
"end": 323,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 314,
"end": 323,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 314,
"end": 317,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 320,
"end": 323,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 325,
"end": 332,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 325,
"end": 332,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 325,
"end": 328,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 301,
"end": 397,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 334,
"end": 397,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 384,
"end": 395,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 391,
"end": 394,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 408,
"end": 410,
"ctxt": 0
},
"value": "f4",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 412,
"end": 415,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 412,
"end": 415,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 417,
"end": 426,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 417,
"end": 426,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 417,
"end": 420,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 423,
"end": 426,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 399,
"end": 446,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 428,
"end": 446,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 434,
"end": 444,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 441,
"end": 444,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 457,
"end": 459,
"ctxt": 0
},
"value": "f5",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 461,
"end": 466,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 461,
"end": 466,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 461,
"end": 462,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 465,
"end": 466,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 448,
"end": 484,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 468,
"end": 484,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 474,
"end": 482,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 495,
"end": 497,
"ctxt": 0
},
"value": "f6",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 499,
"end": 512,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 499,
"end": 512,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 499,
"end": 504,
"ctxt": 0
},
"value": "async",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 507,
"end": 512,
"ctxt": 0
},
"value": "async",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 486,
"end": 534,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 514,
"end": 534,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 520,
"end": 532,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 527,
"end": 532,
"ctxt": 0
},
"value": "async",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 545,
"end": 547,
"ctxt": 0
},
"value": "f7",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 548,
"end": 567,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 548,
"end": 567,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 549,
"end": 554,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 550,
"end": 553,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": {
"type": "Identifier",
"span": {
"start": 556,
"end": 559,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 560,
"end": 567,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 562,
"end": 567,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 562,
"end": 565,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 536,
"end": 597,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 569,
"end": 597,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 575,
"end": 595,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 579,
"end": 594,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 579,
"end": 582,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 582,
"end": 590,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 584,
"end": 590,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 593,
"end": 594,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 605,
"end": 608,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 599,
"end": 660,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 615,
"end": 658,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 615,
"end": 626,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 627,
"end": 640,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 634,
"end": 640,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 634,
"end": 635,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 638,
"end": 640,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
},
"typeAnnotation": null
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 642,
"end": 654,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 649,
"end": 654,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 649,
"end": 650,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 656,
"end": 658,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 671,
"end": 673,
"ctxt": 0
},
"value": "f8",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 674,
"end": 686,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 674,
"end": 686,
"ctxt": 0
},
"value": "foo1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 678,
"end": 686,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 680,
"end": 686,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 688,
"end": 698,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 688,
"end": 698,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 688,
"end": 691,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 694,
"end": 698,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 662,
"end": 703,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 700,
"end": 703,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}