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

608 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 22,
"end": 228,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 39,
"end": 43,
"ctxt": 0
},
"value": "call",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 71,
"end": 101,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 71,
"end": 101,
"ctxt": 0
},
"value": "handler",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 78,
"end": 101,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 80,
"end": 101,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 81,
"end": 92,
"ctxt": 0
},
"rest": {
"start": 81,
"end": 84,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 90,
"end": 92,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 90,
"end": 92,
"ctxt": 0
},
"value": "TS",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 94,
"end": 101,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 97,
"end": 101,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 107,
"end": 118,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 107,
"end": 118,
"ctxt": 0
},
"rest": {
"start": 107,
"end": 110,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 110,
"end": 114,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 114,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 116,
"end": 118,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 116,
"end": 118,
"ctxt": 0
},
"value": "TS",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 22,
"end": 126,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 43,
"end": 65,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 44,
"end": 64,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 44,
"end": 46,
"ctxt": 0
},
"value": "TS",
"optional": false
},
"constraint": {
"type": "TsArrayType",
"span": {
"start": 55,
"end": 64,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 55,
"end": 62,
"ctxt": 0
},
"kind": "unknown"
}
},
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 125,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 121,
"end": 125,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 130,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 130,
"end": 167,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 130,
"end": 134,
"ctxt": 0
},
"value": "call",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 135,
"end": 166,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 136,
"end": 145,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 137,
"end": 145,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 139,
"end": 145,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 147,
"end": 156,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 148,
"end": 156,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 150,
"end": 156,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "BinaryExpression",
"span": {
"start": 161,
"end": 166,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 161,
"end": 162,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 169,
"end": 228,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 169,
"end": 227,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 169,
"end": 173,
"ctxt": 0
},
"value": "call",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 174,
"end": 205,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 175,
"end": 184,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 176,
"end": 184,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 178,
"end": 184,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 186,
"end": 195,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 187,
"end": 195,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 189,
"end": 195,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "BinaryExpression",
"span": {
"start": 200,
"end": 205,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 200,
"end": 201,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 204,
"end": 205,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": 2.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": 3.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": 4.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": 5.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 222,
"end": 223,
"ctxt": 0
},
"value": 6.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": 7.0
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}