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

608 lines
16 KiB
JSON
Raw Normal View History

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