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

662 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 245,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 27,
"end": 31,
"ctxt": 0
},
"value": "Test",
"optional": false
},
"declare": false,
"span": {
"start": 21,
"end": 245,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 38,
"end": 47,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 38,
"end": 40,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 52,
"end": 243,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 59,
"end": 68,
"ctxt": 0
},
"value": "something",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 69,
"end": 97,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 69,
"end": 97,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 72,
"end": 97,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 74,
"end": 97,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 77,
"end": 88,
"ctxt": 0
},
"value": "key",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 88,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 82,
"end": 88,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 89,
"end": 95,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 91,
"end": 95,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 91,
"end": 95,
"ctxt": 0
},
"value": "Test",
"optional": false
},
"typeParams": null
}
},
"readonly": false,
"static": false,
"span": {
"start": 76,
"end": 95,
"ctxt": 0
}
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 52,
"end": 243,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 99,
"end": 243,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 109,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 109,
"end": 167,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 109,
"end": 163,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 109,
"end": 160,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 112,
"end": 160,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 113,
"end": 159,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 113,
"end": 157,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 114,
"end": 156,
"ctxt": 0
},
"callee": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 118,
"end": 156,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 126,
"end": 133,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 126,
"end": 128,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 134,
"end": 154,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 143,
"end": 144,
"ctxt": 0
},
"value": "s",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 147,
"end": 153,
"ctxt": 0
},
"value": "prop",
"raw": "\"prop\""
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": true,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
"arguments": null,
"typeArguments": null
}
},
"property": {
"type": "Identifier",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 161,
"end": 163,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 177,
"end": 237,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 177,
"end": 236,
"ctxt": 0
},
"operator": "+=",
"left": {
"type": "MemberExpression",
"span": {
"start": 177,
"end": 231,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 177,
"end": 228,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 177,
"end": 180,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 180,
"end": 228,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 181,
"end": 227,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 181,
"end": 225,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 182,
"end": 224,
"ctxt": 0
},
"callee": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 186,
"end": 224,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 194,
"end": 201,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 194,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 202,
"end": 222,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "s",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 215,
"end": 221,
"ctxt": 0
},
"value": "prop",
"raw": "\"prop\""
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": true,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
"arguments": null,
"typeArguments": null
}
},
"property": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 229,
"end": 231,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}