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

618 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 41,
"end": 247,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 58,
"end": 62,
"ctxt": 0
},
"value": "call",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 90,
"end": 120,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 90,
"end": 120,
"ctxt": 0
},
"value": "handler",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 97,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 99,
"end": 120,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 100,
"end": 111,
"ctxt": 0
},
"rest": {
"start": 100,
"end": 103,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 103,
"end": 107,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"value": "TS",
"optional": false
},
"typeParams": null
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 113,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 116,
"end": 120,
"ctxt": 0
},
"kind": "void"
}
}
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 126,
"end": 137,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 126,
"end": 137,
"ctxt": 0
},
"rest": {
"start": 126,
"end": 129,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 129,
"end": 133,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 133,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 135,
"end": 137,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 135,
"end": 137,
"ctxt": 0
},
"value": "TS",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 41,
"end": 145,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 62,
"end": 84,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 63,
"end": 83,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 63,
"end": 65,
"ctxt": 0
},
"value": "TS",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": {
"type": "TsArrayType",
"span": {
"start": 74,
"end": 83,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 74,
"end": 81,
"ctxt": 0
},
"kind": "unknown"
}
},
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 138,
"end": 144,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"kind": "void"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 149,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 149,
"end": 186,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 149,
"end": 153,
"ctxt": 0
},
"value": "call",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 154,
"end": 185,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 155,
"end": 164,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 156,
"end": 164,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 158,
"end": 164,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 166,
"end": 175,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 167,
"end": 175,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 169,
"end": 175,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "BinaryExpression",
"span": {
"start": 180,
"end": 185,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 188,
"end": 247,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 188,
"end": 246,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 188,
"end": 192,
"ctxt": 0
},
"value": "call",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 193,
"end": 224,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 194,
"end": 203,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 195,
"end": 203,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 197,
"end": 203,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "Identifier",
"span": {
"start": 205,
"end": 214,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 206,
"end": 214,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 208,
"end": 214,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "BinaryExpression",
"span": {
"start": 219,
"end": 224,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 223,
"end": 224,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 229,
"end": 230,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"value": 5.0,
"raw": "5"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": 6.0,
"raw": "6"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": 7.0,
"raw": "7"
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}