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

787 lines
22 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
2022-02-04 14:17:42 +03:00
"start": 43,
"end": 265,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 43,
"end": 59,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 47,
"end": 58,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 47,
"end": 48,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 51,
"end": 58,
"ctxt": 0
},
"params": [],
"body": {
"type": "NumericLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 57,
"end": 58,
"ctxt": 0
},
"value": 1.0
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 60,
"end": 86,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 64,
"end": 86,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 64,
"end": 65,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 65,
"end": 86,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 67,
"end": 86,
"ctxt": 0
},
"members": [
{
"type": "TsCallSignatureDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 73,
"end": 84,
"ctxt": 0
},
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 75,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 77,
"end": 83,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 88,
"end": 120,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 92,
"end": 119,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 93,
"end": 119,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 95,
"end": 119,
"ctxt": 0
},
"members": [
{
"type": "TsCallSignatureDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 97,
"end": 117,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 98,
"end": 107,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 99,
"end": 107,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 101,
"end": 107,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 108,
"end": 116,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 110,
"end": 116,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 121,
"end": 150,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 125,
"end": 149,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 126,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 128,
"end": 149,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 129,
"end": 138,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 130,
"end": 138,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 132,
"end": 138,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 140,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 143,
"end": 149,
"ctxt": 0
},
"kind": "string"
}
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 151,
"end": 193,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 155,
"end": 193,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 155,
"end": 157,
"ctxt": 0
},
"value": "y2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 157,
"end": 176,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 159,
"end": 176,
"ctxt": 0
},
"members": [
{
"type": "TsCallSignatureDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 161,
"end": 174,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 165,
"end": 169,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 166,
"end": 169,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
2022-02-04 14:17:42 +03:00
"start": 168,
"end": 169,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 170,
"end": 173,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
2022-02-04 14:17:42 +03:00
"start": 172,
"end": 173,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 161,
"end": 164,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 162,
"end": 163,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
}
}
]
}
}
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 179,
"end": 193,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 183,
"end": 187,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 184,
"end": 187,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
2022-02-04 14:17:42 +03:00
"start": 186,
"end": 187,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
],
"body": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "x",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 179,
"end": 182,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
2022-02-04 14:17:42 +03:00
"start": 180,
"end": 181,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 195,
"end": 231,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 199,
"end": 230,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 200,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 202,
"end": 230,
"ctxt": 0
},
"members": [
{
"type": "TsConstructSignatureDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 204,
"end": 228,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 209,
"end": 218,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 210,
"end": 218,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 212,
"end": 218,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 219,
"end": 227,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 221,
"end": 227,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 232,
"end": 265,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 236,
"end": 264,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "z",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 237,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsConstructorType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 239,
"end": 264,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 244,
"end": 253,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 245,
"end": 253,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 247,
"end": 253,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 255,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 258,
"end": 264,
"ctxt": 0
},
"kind": "number"
}
},
"isAbstract": false
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}