swc/crates/swc_ecma_parser/tests/tsc/parameterInitializersForwardReferencing1_es6.json
2022-03-22 07:54:08 +00:00

1275 lines
30 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 722,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 41,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 24,
"end": 40,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 24,
"end": 27,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 27,
"end": 35,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 29,
"end": 35,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 38,
"end": 40,
"ctxt": 0
},
"value": "",
"raw": "\"\""
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 52,
"end": 54,
"ctxt": 0
},
"value": "f1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 56,
"end": 65,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 56,
"end": 65,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 62,
"end": 65,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 43,
"end": 171,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 67,
"end": 171,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 120,
"end": 140,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 124,
"end": 139,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 124,
"end": 127,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 127,
"end": 135,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 129,
"end": 135,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": 2.0
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 152,
"end": 155,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 182,
"end": 184,
"ctxt": 0
},
"value": "f2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 186,
"end": 210,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 186,
"end": 210,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 186,
"end": 189,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 192,
"end": 210,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 193,
"end": 202,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"value": "baz",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 199,
"end": 202,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "Identifier",
"span": {
"start": 207,
"end": 210,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 173,
"end": 318,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 212,
"end": 318,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 265,
"end": 285,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 269,
"end": 284,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 269,
"end": 272,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 272,
"end": 280,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 274,
"end": 280,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": 2.0
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 290,
"end": 303,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 297,
"end": 302,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 297,
"end": 300,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 329,
"end": 331,
"ctxt": 0
},
"value": "f3",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 333,
"end": 342,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 333,
"end": 342,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 333,
"end": 336,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 339,
"end": 342,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 344,
"end": 351,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 344,
"end": 351,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 344,
"end": 347,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 350,
"end": 351,
"ctxt": 0
},
"value": 2.0
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 320,
"end": 416,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 353,
"end": 416,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 403,
"end": 414,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 410,
"end": 413,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 427,
"end": 429,
"ctxt": 0
},
"value": "f4",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 431,
"end": 434,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 431,
"end": 434,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 436,
"end": 445,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 436,
"end": 445,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 436,
"end": 439,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 442,
"end": 445,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 418,
"end": 465,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 447,
"end": 465,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 453,
"end": 463,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 460,
"end": 463,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 476,
"end": 478,
"ctxt": 0
},
"value": "f5",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 480,
"end": 485,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 480,
"end": 485,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 480,
"end": 481,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 484,
"end": 485,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 467,
"end": 503,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 487,
"end": 503,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 493,
"end": 501,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 500,
"end": 501,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 514,
"end": 516,
"ctxt": 0
},
"value": "f6",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 518,
"end": 531,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 518,
"end": 531,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 518,
"end": 523,
"ctxt": 0
},
"value": "async",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 526,
"end": 531,
"ctxt": 0
},
"value": "async",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 505,
"end": 553,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 533,
"end": 553,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 539,
"end": 551,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 546,
"end": 551,
"ctxt": 0
},
"value": "async",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 564,
"end": 566,
"ctxt": 0
},
"value": "f7",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 567,
"end": 586,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 567,
"end": 586,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Computed",
"span": {
"start": 568,
"end": 573,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 569,
"end": 572,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": {
"type": "Identifier",
"span": {
"start": 575,
"end": 578,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 579,
"end": 586,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 581,
"end": 586,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 581,
"end": 584,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 555,
"end": 616,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 588,
"end": 616,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 594,
"end": 614,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 598,
"end": 613,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 598,
"end": 601,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 601,
"end": 609,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 603,
"end": 609,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 612,
"end": 613,
"ctxt": 0
},
"value": 2.0
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 624,
"end": 627,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 618,
"end": 679,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 634,
"end": 677,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 634,
"end": 645,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 646,
"end": 659,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 653,
"end": 659,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 653,
"end": 654,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 657,
"end": 659,
"ctxt": 0
},
"value": 12.0
},
"typeAnnotation": null
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 661,
"end": 673,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "AssignmentPattern",
"span": {
"start": 668,
"end": 673,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 668,
"end": 669,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 672,
"end": 673,
"ctxt": 0
},
"value": "x",
"optional": false
},
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 675,
"end": 677,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 690,
"end": 692,
"ctxt": 0
},
"value": "f8",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 693,
"end": 705,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 693,
"end": 705,
"ctxt": 0
},
"value": "foo1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 697,
"end": 705,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 699,
"end": 705,
"ctxt": 0
},
"kind": "string"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 707,
"end": 717,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 707,
"end": 717,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 707,
"end": 710,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 713,
"end": 717,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 681,
"end": 722,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 719,
"end": 722,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}