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

622 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 51,
"end": 471,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 57,
"end": 64,
"ctxt": 0
},
"value": "MyClass",
"optional": false
},
"declare": false,
"span": {
"start": 51,
"end": 303,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 71,
"end": 81,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "t",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 72,
"end": 80,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 74,
"end": 80,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 87,
"end": 301,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 89,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 87,
"end": 301,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 92,
"end": 301,
"ctxt": 0
},
"stmts": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 102,
"end": 129,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 121,
"ctxt": 0
},
"value": "ContainingThis",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsThisType",
"span": {
"start": 124,
"end": 128,
"ctxt": 0
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 215,
"end": 246,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 219,
"end": 245,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 223,
"end": 245,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ThisExpression",
"span": {
"start": 228,
"end": 232,
"ctxt": 0
}
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 237,
"end": 243,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 237,
"end": 241,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "t",
"optional": false
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 255,
"end": 295,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 259,
"end": 294,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 259,
"end": 260,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 260,
"end": 294,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 262,
"end": 294,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 264,
"end": 282,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 265,
"end": 281,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 267,
"end": 281,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 267,
"end": 281,
"ctxt": 0
},
"value": "ContainingThis",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 283,
"end": 292,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 284,
"end": 292,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 286,
"end": 292,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 384,
"end": 443,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 388,
"end": 442,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 388,
"end": 391,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 394,
"end": 442,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 400,
"end": 401,
"ctxt": 0
},
"value": "f",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 400,
"end": 440,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 404,
"end": 440,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 414,
"end": 434,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 421,
"end": 433,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 421,
"end": 425,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 426,
"end": 433,
"ctxt": 0
},
"value": "spaaace",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 444,
"end": 471,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 448,
"end": 470,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 448,
"end": 451,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 451,
"end": 470,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 453,
"end": 470,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 455,
"end": 468,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "f",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 456,
"end": 467,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 458,
"end": 467,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 461,
"end": 467,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 464,
"end": 467,
"ctxt": 0
},
"kind": "any"
}
}
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}