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

749 lines
17 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 815,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 19,
"ctxt": 0
},
"value": "BaseErrClass",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 51,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 26,
"end": 49,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 26,
"end": 37,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 38,
"end": 44,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 39,
"end": 44,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 59,
"end": 81,
"ctxt": 0
},
"value": "ClassWithNoInitializer",
"optional": false
},
"declare": false,
"span": {
"start": 53,
"end": 205,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 110,
"ctxt": 0
},
"value": "t",
"optional": false
},
"value": null,
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 152,
"end": 203,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 152,
"end": 163,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 166,
"end": 203,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 176,
"end": 188,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 176,
"end": 187,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 176,
"end": 181,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ThisExpression",
"span": {
"start": 182,
"end": 186,
"ctxt": 0
}
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 90,
"end": 102,
"ctxt": 0
},
"value": "BaseErrClass",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 213,
"end": 233,
"ctxt": 0
},
"value": "ClassWithInitializer",
"optional": false
},
"declare": false,
"span": {
"start": 207,
"end": 361,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 261,
"end": 267,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "t",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 308,
"end": 359,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 308,
"end": 319,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 322,
"end": 359,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 332,
"end": 344,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 332,
"end": 343,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 332,
"end": 337,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ThisExpression",
"span": {
"start": 338,
"end": 342,
"ctxt": 0
}
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 242,
"end": 254,
"ctxt": 0
},
"value": "BaseErrClass",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 363,
"end": 434,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 370,
"end": 371,
"ctxt": 0
},
"value": "M",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 372,
"end": 434,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 410,
"end": 423,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 414,
"end": 422,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 414,
"end": 415,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ThisExpression",
"span": {
"start": 418,
"end": 422,
"ctxt": 0
}
},
"definite": false
}
]
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 559,
"end": 570,
"ctxt": 0
},
"value": "genericFunc",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 574,
"end": 578,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 574,
"end": 578,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 575,
"end": 578,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 577,
"end": 578,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 577,
"end": 578,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 550,
"end": 583,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 580,
"end": 583,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 570,
"end": 573,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 571,
"end": 572,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 571,
"end": 572,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 584,
"end": 613,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 584,
"end": 612,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 584,
"end": 595,
"ctxt": 0
},
"value": "genericFunc",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 602,
"end": 611,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
],
"typeArguments": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 595,
"end": 601,
"ctxt": 0
},
"params": [
{
"type": "TsThisType",
"span": {
"start": 596,
"end": 600,
"ctxt": 0
}
}
]
}
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 644,
"end": 653,
"ctxt": 0
},
"value": "ErrClass3",
"optional": false
},
"declare": false,
"span": {
"start": 638,
"end": 671,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": {
"type": "ThisExpression",
"span": {
"start": 662,
"end": 666,
"ctxt": 0
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsEnumDeclaration",
"span": {
"start": 707,
"end": 815,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 712,
"end": 720,
"ctxt": 0
},
"value": "SomeEnum",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 727,
"end": 735,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 727,
"end": 728,
"ctxt": 0
},
"value": "A",
"optional": false
},
"init": {
"type": "ThisExpression",
"span": {
"start": 731,
"end": 735,
"ctxt": 0
}
}
},
{
"type": "TsEnumMember",
"span": {
"start": 766,
"end": 783,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 766,
"end": 767,
"ctxt": 0
},
"value": "B",
"optional": false
},
"init": {
"type": "MemberExpression",
"span": {
"start": 770,
"end": 783,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 770,
"end": 774,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 775,
"end": 783,
"ctxt": 0
},
"value": "spaaaace",
"optional": false
}
}
}
]
}
],
"interpreter": null
}