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

1382 lines
32 KiB
JSON

{
"type": "Module",
"span": {
"start": 1,
"end": 681,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 11,
"ctxt": 0
},
"value": "a",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 12,
"end": 18,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 12,
"end": 18,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 12,
"end": 13,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 16,
"end": 18,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 1,
"end": 41,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 20,
"end": 41,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 26,
"end": 39,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 26,
"end": 38,
"ctxt": 0
},
"value": "use strict",
"raw": "\"use strict\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExportDeclaration",
"span": {
"start": 43,
"end": 63,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 50,
"end": 63,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 54,
"end": 62,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 54,
"end": 57,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 60,
"end": 62,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"definite": false
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "b",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 79,
"end": 81,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 64,
"end": 86,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 83,
"end": 86,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 97,
"end": 106,
"ctxt": 0
},
"value": "container",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 88,
"end": 161,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 109,
"end": 161,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 115,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 115,
"end": 127,
"ctxt": 0
},
"value": "use strict",
"raw": "\"use strict\""
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 148,
"end": 150,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 133,
"end": 159,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 152,
"end": 159,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 172,
"end": 176,
"ctxt": 0
},
"value": "rest",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 177,
"end": 191,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 177,
"end": 191,
"ctxt": 0
},
"rest": {
"start": 177,
"end": 180,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 180,
"end": 184,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 184,
"end": 191,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 186,
"end": 191,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 186,
"end": 189,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 163,
"end": 214,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 193,
"end": 214,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 199,
"end": 212,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 199,
"end": 211,
"ctxt": 0
},
"value": "use strict",
"raw": "'use strict'"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"value": "rest1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 231,
"end": 236,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 231,
"end": 236,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 238,
"end": 245,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 238,
"end": 245,
"ctxt": 0
},
"rest": {
"start": 238,
"end": 241,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 241,
"end": 245,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 216,
"end": 268,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 247,
"end": 268,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 253,
"end": 266,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 253,
"end": 265,
"ctxt": 0
},
"value": "use strict",
"raw": "'use strict'"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 279,
"end": 291,
"ctxt": 0
},
"value": "paramDefault",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 292,
"end": 301,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 292,
"end": 301,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 292,
"end": 297,
"ctxt": 0
},
"value": "param",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 300,
"end": 301,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 270,
"end": 324,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 303,
"end": 324,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 309,
"end": 322,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 309,
"end": 321,
"ctxt": 0
},
"value": "use strict",
"raw": "'use strict'"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 335,
"end": 355,
"ctxt": 0
},
"value": "objectBindingPattern",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 356,
"end": 366,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 356,
"end": 366,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 357,
"end": 360,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 357,
"end": 360,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 361,
"end": 366,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 363,
"end": 366,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 326,
"end": 389,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 368,
"end": 389,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 374,
"end": 387,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 374,
"end": 386,
"ctxt": 0
},
"value": "use strict",
"raw": "'use strict'"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 400,
"end": 419,
"ctxt": 0
},
"value": "arrayBindingPattern",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 420,
"end": 432,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ArrayPattern",
"span": {
"start": 420,
"end": 432,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 421,
"end": 424,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 425,
"end": 432,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 427,
"end": 432,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 427,
"end": 430,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 391,
"end": 455,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 434,
"end": 455,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 440,
"end": 453,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 440,
"end": 452,
"ctxt": 0
},
"value": "use strict",
"raw": "'use strict'"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 466,
"end": 479,
"ctxt": 0
},
"value": "manyParameter",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 480,
"end": 486,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 480,
"end": 486,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 480,
"end": 481,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 484,
"end": 486,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 488,
"end": 494,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 488,
"end": 494,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 488,
"end": 489,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 492,
"end": 494,
"ctxt": 0
},
"value": 20.0,
"raw": "20"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 457,
"end": 517,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 496,
"end": 517,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 502,
"end": 515,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 502,
"end": 514,
"ctxt": 0
},
"value": "use strict",
"raw": "\"use strict\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 528,
"end": 540,
"ctxt": 0
},
"value": "manyPrologue",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 541,
"end": 547,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 541,
"end": 547,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 541,
"end": 542,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 545,
"end": 547,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 549,
"end": 555,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 549,
"end": 555,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 549,
"end": 550,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 553,
"end": 555,
"ctxt": 0
},
"value": 20.0,
"raw": "20"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 519,
"end": 589,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 557,
"end": 589,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 563,
"end": 569,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 563,
"end": 568,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 574,
"end": 587,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 574,
"end": 586,
"ctxt": 0
},
"value": "use strict",
"raw": "\"use strict\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 600,
"end": 615,
"ctxt": 0
},
"value": "invalidPrologue",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 616,
"end": 622,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 616,
"end": 622,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 616,
"end": 617,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 620,
"end": 622,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 624,
"end": 630,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 624,
"end": 630,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 624,
"end": 625,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 628,
"end": 630,
"ctxt": 0
},
"value": 20.0,
"raw": "20"
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 591,
"end": 681,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 632,
"end": 681,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 638,
"end": 644,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 638,
"end": 643,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 649,
"end": 661,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 655,
"end": 660,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 655,
"end": 656,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 659,
"end": 660,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 666,
"end": 679,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 666,
"end": 678,
"ctxt": 0
},
"value": "use strict",
"raw": "\"use strict\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}