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

540 lines
12 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 173,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 88,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 31,
"end": 40,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 40,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 34,
"end": 40,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 41,
"end": 49,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 43,
"end": 49,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": true,
"static": true,
"span": {
"start": 14,
"end": 50,
"ctxt": 0
}
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 72,
"end": 81,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 82,
"end": 86,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 84,
"end": 86,
"ctxt": 0
},
"value": 42.0
}
}
},
"readonly": true,
"static": true,
"span": {
"start": 55,
"end": 86,
"ctxt": 0
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 90,
"end": 102,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 90,
"end": 102,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 90,
"end": 98,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 91,
"end": 98,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 92,
"end": 97,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 103,
"end": 113,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 103,
"end": 112,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 103,
"end": 108,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 105,
"end": 108,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": 2.0
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 114,
"end": 134,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 120,
"end": 134,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 126,
"end": 134,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 127,
"end": 134,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 128,
"end": 133,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 135,
"end": 145,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 135,
"end": 145,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 135,
"end": 140,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 136,
"end": 140,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 137,
"end": 139,
"ctxt": 0
},
"value": 42.0
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 143,
"end": 145,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 146,
"end": 155,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 146,
"end": 154,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 146,
"end": 150,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 146,
"end": 147,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 147,
"end": 150,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": 2.0
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": 2.0
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 156,
"end": 173,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 162,
"end": 173,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 162,
"end": 165,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 168,
"end": 173,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 169,
"end": 173,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 170,
"end": 172,
"ctxt": 0
},
"value": 42.0
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}