swc/crates/swc_ecma_parser/tests/tsc/callOverload.json
2022-04-05 12:46:35 +00:00

757 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 276,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 17,
"end": 19,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 20,
"end": 26,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 20,
"end": 26,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 21,
"end": 26,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 23,
"end": 26,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 0,
"end": 34,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 27,
"end": 33,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 29,
"end": 33,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 52,
"end": 59,
"ctxt": 0
},
"value": "takeTwo",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 60,
"end": 66,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 60,
"end": 66,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 61,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"kind": "any"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 69,
"end": 74,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 35,
"end": 82,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 81,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 100,
"end": 108,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 112,
"end": 115,
"ctxt": 0
},
"kind": "any"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 117,
"end": 136,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 117,
"end": 136,
"ctxt": 0
},
"rest": {
"start": 117,
"end": 120,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 120,
"end": 124,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 124,
"end": 136,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 126,
"end": 136,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 126,
"end": 131,
"ctxt": 0
},
"value": "Array",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 131,
"end": 136,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 132,
"end": 135,
"ctxt": 0
},
"kind": "any"
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 83,
"end": 144,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 137,
"end": 143,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 139,
"end": 143,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 145,
"end": 161,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 149,
"end": 160,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 150,
"end": 160,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 152,
"end": 160,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 152,
"end": 158,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 163,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 163,
"end": 168,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 163,
"end": 165,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 181,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 181,
"end": 195,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 181,
"end": 183,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 190,
"end": 191,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 196,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 196,
"end": 215,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 196,
"end": 203,
"ctxt": 0
},
"value": "takeTwo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 204,
"end": 205,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 216,
"end": 236,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 216,
"end": 235,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 216,
"end": 224,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 225,
"end": 228,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
},
{
"spread": {
"start": 230,
"end": 233,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 249,
"end": 260,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 249,
"end": 259,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 249,
"end": 257,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 261,
"end": 276,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 261,
"end": 275,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 261,
"end": 269,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"arguments": [
{
"spread": {
"start": 270,
"end": 273,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}