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

757 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 277,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 18,
"end": 20,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 21,
"end": 27,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 21,
"end": 27,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 22,
"end": 27,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 24,
"end": 27,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 1,
"end": 35,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 28,
"end": 34,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 30,
"end": 34,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 53,
"end": 60,
"ctxt": 0
},
"value": "takeTwo",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 67,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 67,
"ctxt": 0
},
"kind": "any"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 70,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 72,
"end": 75,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 36,
"end": 83,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 78,
"end": 82,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 101,
"end": 109,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 113,
"end": 116,
"ctxt": 0
},
"kind": "any"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 118,
"end": 137,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 118,
"end": 137,
"ctxt": 0
},
"rest": {
"start": 118,
"end": 121,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 121,
"end": 125,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 125,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 127,
"end": 137,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"value": "Array",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"kind": "any"
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 84,
"end": 145,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 138,
"end": 144,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 146,
"end": 162,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 150,
"end": 161,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 151,
"end": 161,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 153,
"end": 161,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"kind": "number"
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 164,
"end": 169,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 164,
"end": 169,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 164,
"end": 166,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 182,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 182,
"end": 196,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 182,
"end": 184,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 197,
"end": 216,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 197,
"end": 216,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 197,
"end": 204,
"ctxt": 0
},
"value": "takeTwo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 214,
"end": 215,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 217,
"end": 237,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 217,
"end": 236,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 217,
"end": 225,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"value": "a",
"raw": "'a'"
}
},
{
"spread": {
"start": 231,
"end": 234,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 250,
"end": 261,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 250,
"end": 260,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 250,
"end": 258,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 262,
"end": 277,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 262,
"end": 276,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 262,
"end": 270,
"ctxt": 0
},
"value": "withRest",
"optional": false
},
"arguments": [
{
"spread": {
"start": 271,
"end": 274,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 274,
"end": 275,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}