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

1279 lines
31 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 702,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 21,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 20,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 7,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 7,
"end": 15,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 9,
"end": 15,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 18,
"end": 20,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 36,
"end": 39,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 23,
"end": 151,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 47,
"end": 151,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 100,
"end": 120,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 104,
"end": 119,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 104,
"end": 107,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 107,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": 2.0
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 125,
"end": 136,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 132,
"end": 135,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 162,
"end": 164,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 166,
"end": 190,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 166,
"end": 190,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 172,
"end": 190,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 173,
"end": 182,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"value": "baz",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 179,
"end": 182,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 187,
"end": 190,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 153,
"end": 298,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 192,
"end": 298,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 245,
"end": 265,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 249,
"end": 264,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 249,
"end": 252,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 252,
"end": 260,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 254,
"end": 260,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": 2.0
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 270,
"end": 283,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 277,
"end": 282,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 277,
"end": 280,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 309,
"end": 311,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 313,
"end": 322,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 313,
"end": 322,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 313,
"end": 316,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 319,
"end": 322,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 324,
"end": 331,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 324,
"end": 331,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 324,
"end": 327,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": 2.0
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 300,
"end": 396,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 333,
"end": 396,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 383,
"end": 394,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 390,
"end": 393,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 407,
"end": 409,
"ctxt": 0
},
"value": "f4",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 411,
"end": 414,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 411,
"end": 414,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 416,
"end": 425,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 416,
"end": 425,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 416,
"end": 419,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 422,
"end": 425,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 398,
"end": 445,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 427,
"end": 445,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 433,
"end": 443,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 440,
"end": 443,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 456,
"end": 458,
"ctxt": 0
},
"value": "f5",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 460,
"end": 465,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 460,
"end": 465,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 460,
"end": 461,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 447,
"end": 483,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 467,
"end": 483,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 473,
"end": 481,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 480,
"end": 481,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 494,
"end": 496,
"ctxt": 0
},
"value": "f6",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 498,
"end": 511,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 498,
"end": 511,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 498,
"end": 503,
"ctxt": 0
},
"value": "async",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 506,
"end": 511,
"ctxt": 0
},
"value": "async",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 485,
"end": 533,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 513,
"end": 533,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 519,
"end": 531,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 526,
"end": 531,
"ctxt": 0
},
"value": "async",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 544,
"end": 546,
"ctxt": 0
},
"value": "f7",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 547,
"end": 566,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 547,
"end": 566,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 548,
"end": 553,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 549,
"end": 552,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": {
"type": "Identifier",
"span": {
"start": 555,
"end": 558,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 559,
"end": 566,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 561,
"end": 566,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 561,
"end": 564,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 535,
"end": 596,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 568,
"end": 596,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 574,
"end": 594,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 578,
"end": 593,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 578,
"end": 581,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 581,
"end": 589,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 583,
"end": 589,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 592,
"end": 593,
"ctxt": 0
},
"value": 2.0
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 604,
"end": 607,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 598,
"end": 659,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 614,
"end": 657,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 614,
"end": 625,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 626,
"end": 639,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 633,
"end": 639,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 633,
"end": 634,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 637,
"end": 639,
"ctxt": 0
},
"value": 12.0
},
"typeAnnotation": null
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 641,
"end": 653,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 648,
"end": 653,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 648,
"end": 649,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 652,
"end": 653,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 655,
"end": 657,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 670,
"end": 672,
"ctxt": 0
},
"value": "f8",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 673,
"end": 685,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 673,
"end": 685,
"ctxt": 0
},
"value": "foo1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 677,
"end": 685,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 679,
"end": 685,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 687,
"end": 697,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 687,
"end": 697,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 687,
"end": 690,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 693,
"end": 697,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 661,
"end": 702,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 699,
"end": 702,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}