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

967 lines
26 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 16,
"end": 363,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 16,
"end": 50,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 20,
"end": 50,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 20,
"end": 27,
"ctxt": 0
},
"value": "lambda1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 30,
"end": 50,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 31,
"end": 42,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 35,
"end": 42,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 96,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 96,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 62,
"ctxt": 0
},
"value": "lambda2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 65,
"end": 96,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 66,
"end": 75,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "AssignmentPattern",
"span": {
"start": 77,
"end": 88,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 81,
"end": 88,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 97,
"end": 151,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 101,
"end": 151,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 101,
"end": 108,
"ctxt": 0
},
"value": "lambda3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 111,
"end": 151,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 112,
"end": 121,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 113,
"end": 121,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 115,
"end": 121,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "AssignmentPattern",
"span": {
"start": 123,
"end": 134,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 127,
"end": 134,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 139,
"end": 143,
"ctxt": 0
},
"rest": {
"start": 136,
"end": 139,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 139,
"end": 143,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 148,
"end": 151,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 152,
"end": 195,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 156,
"end": 195,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 156,
"end": 163,
"ctxt": 0
},
"value": "lambda4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 166,
"end": 195,
"ctxt": 0
},
"params": [
{
"type": "AssignmentPattern",
"span": {
"start": 167,
"end": 178,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 171,
"end": 178,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 183,
"end": 187,
"ctxt": 0
},
"rest": {
"start": 180,
"end": 183,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 183,
"end": 187,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 197,
"end": 242,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 201,
"end": 242,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 215,
"end": 228,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 215,
"end": 228,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 215,
"end": 218,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 221,
"end": 228,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 230,
"end": 237,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 230,
"end": 237,
"ctxt": 0
},
"rest": {
"start": 230,
"end": 233,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 233,
"end": 237,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 205,
"end": 242,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 239,
"end": 242,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 243,
"end": 300,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 247,
"end": 300,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 251,
"end": 300,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 251,
"end": 298,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 262,
"end": 270,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 262,
"end": 270,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 262,
"end": 265,
"ctxt": 0
},
"value": "num",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 268,
"end": 270,
"ctxt": 0
},
"value": 10.0
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 272,
"end": 283,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 272,
"end": 283,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 272,
"end": 275,
"ctxt": 0
},
"value": "boo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 278,
"end": 283,
"ctxt": 0
},
"value": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 285,
"end": 292,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 285,
"end": 292,
"ctxt": 0
},
"rest": {
"start": 285,
"end": 288,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 288,
"end": 292,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 252,
"end": 297,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 294,
"end": 297,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 301,
"end": 363,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 305,
"end": 363,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 309,
"end": 363,
"ctxt": 0
},
"callee": {
"type": "ParenthesisExpression",
"span": {
"start": 309,
"end": 359,
"ctxt": 0
},
"expression": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 320,
"end": 331,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 320,
"end": 331,
"ctxt": 0
},
"value": "num",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 323,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 333,
"end": 344,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 333,
"end": 344,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 333,
"end": 336,
"ctxt": 0
},
"value": "boo",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 339,
"end": 344,
"ctxt": 0
},
"value": false
},
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 346,
"end": 353,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 346,
"end": 353,
"ctxt": 0
},
"rest": {
"start": 346,
"end": 349,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 349,
"end": 353,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 310,
"end": 358,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 355,
"end": 358,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 360,
"end": 362,
"ctxt": 0
},
"value": 10.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}