swc/crates/swc_ecma_parser/tests/tsc/emitArrowFunction.json
Donny/강동윤 3958f1792c
refactor(es/ast): Remove unused fields (#7518)
**Related issue:**

 - Closes #7347.
 - Closes #7487.
2023-06-12 08:02:34 +00:00

662 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 253,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 16,
"end": 34,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 20,
"end": 34,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 20,
"end": 22,
"ctxt": 0
},
"value": "f1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 25,
"end": 34,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 31,
"end": 34,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 35,
"end": 73,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 39,
"end": 73,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 39,
"end": 41,
"ctxt": 0
},
"value": "f2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 44,
"end": 73,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"kind": "string"
}
}
},
{
"type": "Identifier",
"span": {
"start": 56,
"end": 65,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 57,
"end": 65,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 59,
"end": 65,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 70,
"end": 73,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 74,
"end": 121,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 78,
"end": 121,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 78,
"end": 80,
"ctxt": 0
},
"value": "f3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 83,
"end": 121,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 87,
"end": 93,
"ctxt": 0
},
"kind": "string"
}
}
},
{
"type": "Identifier",
"span": {
"start": 95,
"end": 104,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 96,
"end": 104,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 98,
"end": 104,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "RestElement",
"span": {
"start": 109,
"end": 113,
"ctxt": 0
},
"rest": {
"start": 106,
"end": 109,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 109,
"end": 113,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 118,
"end": 121,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 122,
"end": 168,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 126,
"end": 168,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 126,
"end": 128,
"ctxt": 0
},
"value": "f4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 131,
"end": 168,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 132,
"end": 141,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 135,
"end": 141,
"ctxt": 0
},
"kind": "string"
}
}
},
{
"type": "Identifier",
"span": {
"start": 143,
"end": 152,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 152,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "AssignmentPattern",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 158,
"end": 160,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 165,
"end": 168,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 182,
"end": 201,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 182,
"end": 201,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 186,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 188,
"end": 201,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 191,
"end": 201,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 194,
"end": 201,
"ctxt": 0
},
"kind": "boolean"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 169,
"end": 206,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 203,
"end": 206,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 207,
"end": 223,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 207,
"end": 222,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 207,
"end": 210,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 211,
"end": 221,
"ctxt": 0
},
"params": [],
"body": {
"type": "BooleanLiteral",
"span": {
"start": 217,
"end": 221,
"ctxt": 0
},
"value": true
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 224,
"end": 253,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 224,
"end": 252,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 224,
"end": 227,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 228,
"end": 251,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 234,
"end": 251,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 236,
"end": 249,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 243,
"end": 248,
"ctxt": 0
},
"value": false
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}