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

540 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 174,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 8,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 89,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 32,
"end": 41,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 41,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 44,
"end": 50,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": true,
"static": true,
"span": {
"start": 15,
"end": 51,
"ctxt": 0
}
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 73,
"end": 82,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 74,
"end": 82,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 87,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 85,
"end": 87,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 85,
"end": 87,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"readonly": true,
"static": true,
"span": {
"start": 56,
"end": 87,
"ctxt": 0
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 91,
"end": 103,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 91,
"end": 103,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 91,
"end": 99,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 92,
"end": 99,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 93,
"end": 98,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 104,
"end": 114,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 104,
"end": 113,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 104,
"end": 109,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 106,
"end": 109,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 112,
"end": 113,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 115,
"end": 135,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 121,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 121,
"end": 124,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 127,
"end": 135,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 128,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 129,
"end": 134,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 146,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 136,
"end": 146,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 136,
"end": 141,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 138,
"end": 140,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 144,
"end": 146,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 147,
"end": 156,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 147,
"end": 155,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 147,
"end": 151,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 148,
"end": 151,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 157,
"end": 174,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 163,
"end": 174,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 163,
"end": 166,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 169,
"end": 174,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 169,
"end": 170,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 170,
"end": 174,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 171,
"end": 173,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}