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

402 lines
9.9 KiB
JSON

{
"type": "Script",
"span": {
"start": 105,
"end": 216,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 116,
"end": 125,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 116,
"end": 125,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 120,
"end": 124,
"ctxt": 0
},
"rest": {
"start": 120,
"end": 123,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 105,
"end": 151,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 151,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 140,
"end": 149,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "g",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 164,
"end": 173,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "ObjectPattern",
"span": {
"start": 164,
"end": 173,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 168,
"end": 172,
"ctxt": 0
},
"rest": {
"start": 168,
"end": 171,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 175,
"end": 197,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 175,
"end": 197,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 179,
"end": 197,
"ctxt": 0
},
"params": [
{
"type": "ObjectPattern",
"span": {
"start": 180,
"end": 183,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
{
"type": "AssignmentPattern",
"span": {
"start": 185,
"end": 190,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "a",
"optional": false
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 195,
"end": 197,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 153,
"end": 216,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 199,
"end": 216,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 205,
"end": 214,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 212,
"end": 213,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}