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

710 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 249,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 27,
"end": 30,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 18,
"end": 163,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 34,
"end": 163,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 40,
"end": 161,
"ctxt": 0
},
"argument": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 47,
"end": 161,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 74,
"end": 83,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 75,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 86,
"end": 92,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": true,
"span": {
"start": 66,
"end": 92,
"ctxt": 0
}
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 109,
"end": 118,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 110,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 112,
"end": 118,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 121,
"end": 123,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 121,
"end": 123,
"ctxt": 0
},
"value": 42.0
}
}
},
"readonly": false,
"static": true,
"span": {
"start": 101,
"end": 123,
"ctxt": 0
}
},
{
"type": "ClassMethod",
"span": {
"start": 133,
"end": 155,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 133,
"end": 136,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 140,
"end": 141,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 140,
"end": 141,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 133,
"end": 155,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 143,
"end": 155,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 145,
"end": 153,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 152,
"end": 153,
"ctxt": 0
},
"value": "v",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 52,
"end": 55,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 53,
"end": 54,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 53,
"end": 54,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 165,
"end": 180,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 171,
"end": 180,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "C",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 175,
"end": 180,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 175,
"end": 178,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 181,
"end": 185,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 181,
"end": 184,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 183,
"end": 184,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 186,
"end": 194,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 186,
"end": 193,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 186,
"end": 189,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 195,
"end": 200,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 195,
"end": 199,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 196,
"end": 199,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": 2.0
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 201,
"end": 211,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 201,
"end": 210,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 201,
"end": 205,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 202,
"end": 205,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"value": 2.0
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 208,
"end": 210,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 213,
"end": 239,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 219,
"end": 238,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 223,
"end": 238,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 228,
"end": 236,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 229,
"end": 235,
"ctxt": 0
},
"kind": "number"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 240,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 240,
"end": 248,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 240,
"end": 245,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 240,
"end": 241,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 242,
"end": 245,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 246,
"end": 247,
"ctxt": 0
},
"value": 1.0
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}