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

399 lines
10 KiB
JSON

{
"type": "Script",
"span": {
"start": 35,
"end": 459,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 35,
"end": 459,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 50,
"end": 59,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 51,
"end": 59,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 53,
"end": 59,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 60,
"end": 65,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 62,
"end": 65,
"ctxt": 0
},
"kind": "any"
}
},
"readonly": false,
"static": false,
"span": {
"start": 49,
"end": 66,
"ctxt": 0
}
},
{
"type": "PrivateProperty",
"span": {
"start": 71,
"end": 80,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 71,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 75,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 85,
"end": 108,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 86,
"end": 92,
"ctxt": 0
},
"value": "#bar",
"raw": "\"#bar\""
}
},
"value": {
"type": "MemberExpression",
"span": {
"start": 96,
"end": 108,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 96,
"end": 100,
"ctxt": 0
}
},
"property": {
"type": "Computed",
"span": {
"start": 100,
"end": 108,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 101,
"end": 107,
"ctxt": 0
},
"value": "#bar",
"raw": "\"#bar\""
}
}
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 200,
"end": 457,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 200,
"end": 211,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 212,
"end": 227,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 212,
"end": 227,
"ctxt": 0
},
"value": "message",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 219,
"end": 227,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 221,
"end": 227,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 229,
"end": 457,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 239,
"end": 250,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 239,
"end": 250,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 239,
"end": 246,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 239,
"end": 243,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 244,
"end": 246,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 245,
"end": 246,
"ctxt": 0
},
"value": "f",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 337,
"end": 354,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 337,
"end": 353,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 337,
"end": 349,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 337,
"end": 341,
"ctxt": 0
}
},
"property": {
"type": "Computed",
"span": {
"start": 341,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 342,
"end": 348,
"ctxt": 0
},
"value": "#foo",
"raw": "\"#foo\""
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}