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

827 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 14,
"end": 518,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 14,
"end": 57,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 24,
"end": 30,
"ctxt": 0
},
"value": "IPoint",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 31,
"end": 57,
"ctxt": 0
},
"body": [
{
"type": "TsMethodSignature",
"span": {
"start": 37,
"end": 55,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 37,
"end": 44,
"ctxt": 0
},
"value": "getDist",
"optional": false
},
"computed": false,
"optional": false,
"params": [],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 69,
"end": 434,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 76,
"end": 82,
"ctxt": 0
},
"value": "Shapes",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 83,
"end": 434,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 103,
"end": 431,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 116,
"end": 121,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"declare": false,
"span": {
"start": 110,
"end": 431,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 151,
"end": 171,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 158,
"end": 161,
"ctxt": 0
},
"value": "con",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 161,
"end": 170,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 163,
"end": 170,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 163,
"end": 170,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
}
},
"isStatic": false,
"decorators": [],
"accessibility": "public",
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 203,
"end": 255,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 203,
"end": 214,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 216,
"end": 232,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 223,
"end": 232,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 224,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 226,
"end": 232,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 234,
"end": 250,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 241,
"end": 250,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 242,
"end": 250,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 244,
"end": 250,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 252,
"end": 255,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 292,
"end": 358,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 292,
"end": 299,
"ctxt": 0
},
"value": "getDist",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 292,
"end": 358,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 302,
"end": 358,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 304,
"end": 356,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 311,
"end": 355,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 311,
"end": 320,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 311,
"end": 315,
"ctxt": 0
},
"value": "Math",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 316,
"end": 320,
"ctxt": 0
},
"value": "sqrt",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 321,
"end": 354,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "BinaryExpression",
"span": {
"start": 321,
"end": 336,
"ctxt": 0
},
"operator": "*",
"left": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 327,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 321,
"end": 325,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 330,
"end": 336,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 330,
"end": 334,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 335,
"end": 336,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 339,
"end": 354,
"ctxt": 0
},
"operator": "*",
"left": {
"type": "MemberExpression",
"span": {
"start": 339,
"end": 345,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 339,
"end": 343,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 344,
"end": 345,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "MemberExpression",
"span": {
"start": 348,
"end": 354,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 348,
"end": 352,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 393,
"end": 425,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 400,
"end": 406,
"ctxt": 0
},
"value": "origin",
"optional": false
},
"value": {
"type": "NewExpression",
"span": {
"start": 409,
"end": 424,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 413,
"end": 418,
"ctxt": 0
},
"value": "Point",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 419,
"end": 420,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
},
"typeAnnotation": null,
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"value": "IPoint",
"optional": false
},
"typeArguments": null
}
]
}
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 455,
"end": 494,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 459,
"end": 493,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 459,
"end": 460,
"ctxt": 0
},
"value": "p",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 460,
"end": 468,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 462,
"end": 468,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 462,
"end": 468,
"ctxt": 0
},
"value": "IPoint",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "NewExpression",
"span": {
"start": 471,
"end": 493,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 475,
"end": 487,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 475,
"end": 481,
"ctxt": 0
},
"value": "Shapes",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 482,
"end": 487,
"ctxt": 0
},
"value": "Point",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 488,
"end": 489,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 491,
"end": 492,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 495,
"end": 518,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 499,
"end": 517,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 499,
"end": 503,
"ctxt": 0
},
"value": "dist",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 506,
"end": 517,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 506,
"end": 515,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 506,
"end": 507,
"ctxt": 0
},
"value": "p",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 508,
"end": 515,
"ctxt": 0
},
"value": "getDist",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}