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

622 lines
20 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 50,
"end": 470,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 56,
"end": 63,
"ctxt": 0
},
"value": "MyClass",
"optional": false
},
"declare": false,
"span": {
"start": 50,
"end": 302,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 70,
"end": 80,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "t",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 71,
"end": 79,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 73,
"end": 79,
"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": 86,
"end": 300,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 86,
"end": 88,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 86,
"end": 300,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 91,
"end": 300,
"ctxt": 0
},
"stmts": [
{
"type": "TsTypeAliasDeclaration",
"span": {
"start": 101,
"end": 128,
"ctxt": 0
},
"declare": false,
"id": {
"type": "Identifier",
"span": {
"start": 106,
"end": 120,
"ctxt": 0
},
"value": "ContainingThis",
"optional": false
},
"typeParams": null,
"typeAnnotation": {
"type": "TsThisType",
"span": {
"start": 123,
"end": 127,
"ctxt": 0
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 214,
"end": 245,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 218,
"end": 244,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 222,
"end": 244,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ThisExpression",
"span": {
"start": 227,
"end": 231,
"ctxt": 0
}
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 236,
"end": 242,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 236,
"end": 240,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "t",
"optional": false
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 254,
"end": 294,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 258,
"end": 293,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 258,
"end": 259,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 259,
"end": 293,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 261,
"end": 293,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 263,
"end": 281,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 264,
"end": 280,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 266,
"end": 280,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 266,
"end": 280,
"ctxt": 0
},
"value": "ContainingThis",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 282,
"end": 291,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 283,
"end": 291,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 285,
"end": 291,
"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": 383,
"end": 442,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 387,
"end": 441,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 387,
"end": 390,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 393,
"end": 441,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 399,
"end": 400,
"ctxt": 0
},
"value": "f",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 399,
"end": 439,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 403,
"end": 439,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 413,
"end": 433,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 420,
"end": 432,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 420,
"end": 424,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 425,
"end": 432,
"ctxt": 0
},
"value": "spaaace",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 443,
"end": 470,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 447,
"end": 469,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 447,
"end": 450,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 450,
"end": 469,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 452,
"end": 469,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 454,
"end": 467,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 454,
"end": 455,
"ctxt": 0
},
"value": "f",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 455,
"end": 466,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 457,
"end": 466,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 460,
"end": 466,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 463,
"end": 466,
"ctxt": 0
},
"kind": "any"
}
}
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
}
],
"interpreter": null
}