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

969 lines
26 KiB
JSON

{
"type": "Script",
"span": {
"start": 17,
"end": 364,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 17,
"end": 51,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 21,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 21,
"end": 28,
"ctxt": 0
},
"value": "lambda1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 31,
"end": 51,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 32,
"end": 43,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 36,
"end": 43,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 97,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 97,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 63,
"ctxt": 0
},
"value": "lambda2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 66,
"end": 97,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 67,
"end": 76,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 68,
"end": 76,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "AssignmentPattern",
"span": {
"start": 78,
"end": 89,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 82,
"end": 89,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 94,
"end": 97,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 98,
"end": 152,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 102,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 102,
"end": 109,
"ctxt": 0
},
"value": "lambda3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 112,
"end": 152,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 113,
"end": 122,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 114,
"end": 122,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 116,
"end": 122,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "AssignmentPattern",
"span": {
"start": 124,
"end": 135,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 128,
"end": 135,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"rest": {
"start": 137,
"end": 140,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 149,
"end": 152,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 153,
"end": 196,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 157,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 157,
"end": 164,
"ctxt": 0
},
"value": "lambda4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 167,
"end": 196,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 168,
"end": 179,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 172,
"end": 179,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 184,
"end": 188,
"ctxt": 0
},
"rest": {
"start": 181,
"end": 184,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 184,
"end": 188,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 198,
"end": 243,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 202,
"end": 243,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 216,
"end": 229,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 216,
"end": 229,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 216,
"end": 219,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 222,
"end": 229,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 231,
"end": 238,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 231,
"end": 238,
"ctxt": 0
},
"rest": {
"start": 231,
"end": 234,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 234,
"end": 238,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 206,
"end": 243,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 240,
"end": 243,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 244,
"end": 301,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 248,
"end": 301,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 252,
"end": 301,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 252,
"end": 299,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 263,
"end": 271,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 263,
"end": 271,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 263,
"end": 266,
"ctxt": 0
},
"value": "num",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 269,
"end": 271,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 273,
"end": 284,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 273,
"end": 284,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 273,
"end": 276,
"ctxt": 0
},
"value": "boo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 279,
"end": 284,
"ctxt": 0
},
"value": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 286,
"end": 293,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 286,
"end": 293,
"ctxt": 0
},
"rest": {
"start": 286,
"end": 289,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 289,
"end": 293,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 253,
"end": 298,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 295,
"end": 298,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 302,
"end": 364,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 306,
"end": 364,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 310,
"end": 364,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 310,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 321,
"end": 332,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 321,
"end": 332,
"ctxt": 0
},
"value": "num",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 324,
"end": 332,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 326,
"end": 332,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 334,
"end": 345,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 334,
"end": 345,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 334,
"end": 337,
"ctxt": 0
},
"value": "boo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 340,
"end": 345,
"ctxt": 0
},
"value": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 347,
"end": 354,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 347,
"end": 354,
"ctxt": 0
},
"rest": {
"start": 347,
"end": 350,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 350,
"end": 354,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 311,
"end": 359,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 356,
"end": 359,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 361,
"end": 363,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}