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

408 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 34,
"end": 458,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 40,
"end": 41,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 34,
"end": 458,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 49,
"end": 58,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 50,
"end": 58,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 52,
"end": 58,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 59,
"end": 64,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 61,
"end": 64,
"ctxt": 0
},
"kind": "any"
}
},
"readonly": false,
"static": false,
"span": {
"start": 48,
"end": 65,
"ctxt": 0
}
},
{
"type": "PrivateProperty",
"span": {
"start": 70,
"end": 79,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 70,
"end": 74,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": 3.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 84,
"end": 107,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 84,
"end": 92,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 85,
"end": 91,
"ctxt": 0
},
"value": "#bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"value": {
"type": "MemberExpression",
"span": {
"start": 95,
"end": 107,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 95,
"end": 99,
"ctxt": 0
}
},
"property": {
"type": "Computed",
"span": {
"start": 99,
"end": 107,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"value": "#bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 199,
"end": 456,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 199,
"end": 210,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 211,
"end": 226,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 211,
"end": 226,
"ctxt": 0
},
"value": "message",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 218,
"end": 226,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 220,
"end": 226,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 228,
"end": 456,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 238,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 238,
"end": 249,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 238,
"end": 245,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 238,
"end": 242,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 243,
"end": 245,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "f",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": 3.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 336,
"end": 353,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 336,
"end": 352,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 336,
"end": 348,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 336,
"end": 340,
"ctxt": 0
}
},
"property": {
"type": "Computed",
"span": {
"start": 340,
"end": 348,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 341,
"end": 347,
"ctxt": 0
},
"value": "#foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": 3.0
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}