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

1280 lines
31 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 21,
"end": 723,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 21,
"end": 42,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 25,
"end": 41,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 25,
"end": 28,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 28,
"end": 36,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 30,
"end": 36,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 39,
"end": 41,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 53,
"end": 55,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 57,
"end": 66,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 57,
"end": 66,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 44,
"end": 172,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 68,
"end": 172,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 121,
"end": 141,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 125,
"end": 140,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 128,
"end": 136,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 130,
"end": 136,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 146,
"end": 157,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 153,
"end": 156,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 183,
"end": 185,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 187,
"end": 211,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 187,
"end": 211,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 187,
"end": 190,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 193,
"end": 211,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 194,
"end": 203,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 194,
"end": 197,
"ctxt": 0
},
"value": "baz",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 200,
"end": 203,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 208,
"end": 211,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 174,
"end": 319,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 213,
"end": 319,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 266,
"end": 286,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 270,
"end": 285,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 270,
"end": 273,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 273,
"end": 281,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 275,
"end": 281,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 284,
"end": 285,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 291,
"end": 304,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 298,
"end": 303,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 298,
"end": 301,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 330,
"end": 332,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 334,
"end": 343,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 334,
"end": 343,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 334,
"end": 337,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 340,
"end": 343,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 345,
"end": 352,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 345,
"end": 352,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 345,
"end": 348,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 321,
"end": 417,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 354,
"end": 417,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 404,
"end": 415,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 411,
"end": 414,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 428,
"end": 430,
"ctxt": 0
},
"value": "f4",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 432,
"end": 435,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 432,
"end": 435,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 437,
"end": 446,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 437,
"end": 446,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 437,
"end": 440,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 443,
"end": 446,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 419,
"end": 466,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 448,
"end": 466,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 454,
"end": 464,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 461,
"end": 464,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 477,
"end": 479,
"ctxt": 0
},
"value": "f5",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 481,
"end": 486,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 481,
"end": 486,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 468,
"end": 504,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 488,
"end": 504,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 494,
"end": 502,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 501,
"end": 502,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 515,
"end": 517,
"ctxt": 0
},
"value": "f6",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 519,
"end": 532,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 519,
"end": 532,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 519,
"end": 524,
"ctxt": 0
},
"value": "async",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 527,
"end": 532,
"ctxt": 0
},
"value": "async",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 506,
"end": 554,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 534,
"end": 554,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 540,
"end": 552,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 547,
"end": 552,
"ctxt": 0
},
"value": "async",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 565,
"end": 567,
"ctxt": 0
},
"value": "f7",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 568,
"end": 587,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 568,
"end": 587,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 569,
"end": 574,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 570,
"end": 573,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": {
"type": "Identifier",
"span": {
"start": 576,
"end": 579,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 580,
"end": 587,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 582,
"end": 587,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 582,
"end": 585,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 556,
"end": 617,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 589,
"end": 617,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 595,
"end": 615,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 599,
"end": 614,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 599,
"end": 602,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 602,
"end": 610,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 604,
"end": 610,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 613,
"end": 614,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 625,
"end": 628,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 619,
"end": 680,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 635,
"end": 678,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 635,
"end": 646,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 647,
"end": 660,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 654,
"end": 660,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 654,
"end": 655,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 658,
"end": 660,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
},
"typeAnnotation": null
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 662,
"end": 674,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 669,
"end": 674,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 669,
"end": 670,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 673,
"end": 674,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 676,
"end": 678,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 691,
"end": 693,
"ctxt": 0
},
"value": "f8",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 694,
"end": 706,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 694,
"end": 706,
"ctxt": 0
},
"value": "foo1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 698,
"end": 706,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 700,
"end": 706,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 708,
"end": 718,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 708,
"end": 718,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 708,
"end": 711,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 714,
"end": 718,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 682,
"end": 723,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 720,
"end": 723,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}