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

540 lines
12 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 156,
"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": 71,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 23,
"end": 32,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 24,
"end": 32,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 26,
"end": 32,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 41,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": true,
"span": {
"start": 15,
"end": 42,
"ctxt": 0
}
},
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 55,
"end": 64,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 56,
"end": 64,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 58,
"end": 64,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 65,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 67,
"end": 69,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 67,
"end": 69,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"readonly": false,
"static": true,
"span": {
"start": 47,
"end": 69,
"ctxt": 0
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 73,
"end": 85,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 73,
"end": 85,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 74,
"end": 81,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 75,
"end": 80,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 84,
"end": 85,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 86,
"end": 96,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 86,
"end": 95,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 86,
"end": 91,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 88,
"end": 91,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 97,
"end": 117,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 103,
"end": 117,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 109,
"end": 117,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 110,
"end": 117,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 111,
"end": 116,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 118,
"end": 128,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 118,
"end": 128,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 118,
"end": 123,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 119,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 120,
"end": 122,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 126,
"end": 128,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 129,
"end": 138,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 129,
"end": 137,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 129,
"end": 133,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 139,
"end": 156,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 145,
"end": 148,
"ctxt": 0
},
"value": "bar",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 151,
"end": 156,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 152,
"end": 156,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 153,
"end": 155,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}