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

716 lines
19 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 19,
"end": 250,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 19,
"end": 164,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 35,
"end": 164,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 41,
"end": 162,
"ctxt": 0
},
"argument": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 48,
"end": 162,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 75,
"end": 84,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 84,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 78,
"end": 84,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 87,
"end": 93,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": true,
"span": {
"start": 67,
"end": 93,
"ctxt": 0
}
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 110,
"end": 119,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 119,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 113,
"end": 119,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 120,
"end": 124,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 122,
"end": 124,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 122,
"end": 124,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"readonly": false,
"static": true,
"span": {
"start": 102,
"end": 124,
"ctxt": 0
}
},
{
"type": "ClassMethod",
"span": {
"start": 134,
"end": 156,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 138,
"end": 142,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 138,
"end": 142,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 139,
"end": 142,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 141,
"end": 142,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 141,
"end": 142,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 134,
"end": 156,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 144,
"end": 156,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 146,
"end": 154,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"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": 53,
"end": 56,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 54,
"end": 55,
"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": 166,
"end": 181,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 172,
"end": 181,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "C",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 176,
"end": 181,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 176,
"end": 179,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 182,
"end": 186,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 182,
"end": 185,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 187,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 187,
"end": 194,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 187,
"end": 190,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 193,
"end": 194,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 196,
"end": 201,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 196,
"end": 200,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 197,
"end": 200,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 198,
"end": 199,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 202,
"end": 212,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 202,
"end": 211,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 202,
"end": 206,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 202,
"end": 203,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 203,
"end": 206,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 204,
"end": 205,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 209,
"end": 211,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 214,
"end": 240,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 220,
"end": 239,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 220,
"end": 221,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 224,
"end": 239,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 228,
"end": 229,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 229,
"end": 237,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 230,
"end": 236,
"ctxt": 0
},
"kind": "number"
}
]
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 241,
"end": 250,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 241,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 241,
"end": 246,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}