mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
4d3fcb86e4
**Related issue:** - Closes #7179
579 lines
16 KiB
JSON
579 lines
16 KiB
JSON
{
|
|
"type": "Module",
|
|
"span": {
|
|
"start": 168,
|
|
"end": 472,
|
|
"ctxt": 0
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "ExportDeclaration",
|
|
"span": {
|
|
"start": 168,
|
|
"end": 305,
|
|
"ctxt": 0
|
|
},
|
|
"declaration": {
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 184,
|
|
"end": 189,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Point",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 190,
|
|
"end": 191,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 190,
|
|
"end": 191,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
}
|
|
},
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 193,
|
|
"end": 194,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 193,
|
|
"end": 194,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 175,
|
|
"end": 305,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 196,
|
|
"end": 305,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "IfStatement",
|
|
"span": {
|
|
"start": 202,
|
|
"end": 271,
|
|
"ctxt": 0
|
|
},
|
|
"test": {
|
|
"type": "UnaryExpression",
|
|
"span": {
|
|
"start": 206,
|
|
"end": 230,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "!",
|
|
"argument": {
|
|
"type": "ParenthesisExpression",
|
|
"span": {
|
|
"start": 207,
|
|
"end": 230,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 208,
|
|
"end": 229,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "instanceof",
|
|
"left": {
|
|
"type": "ThisExpression",
|
|
"span": {
|
|
"start": 208,
|
|
"end": 212,
|
|
"ctxt": 0
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 224,
|
|
"end": 229,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Point",
|
|
"optional": false
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"consequent": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 232,
|
|
"end": 271,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 242,
|
|
"end": 265,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "NewExpression",
|
|
"span": {
|
|
"start": 249,
|
|
"end": 264,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 253,
|
|
"end": 258,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Point",
|
|
"optional": false
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 259,
|
|
"end": 260,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 262,
|
|
"end": 263,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"alternate": null
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 276,
|
|
"end": 287,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 276,
|
|
"end": 286,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 276,
|
|
"end": 282,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "ThisExpression",
|
|
"span": {
|
|
"start": 276,
|
|
"end": 280,
|
|
"ctxt": 0
|
|
}
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 281,
|
|
"end": 282,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 285,
|
|
"end": 286,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ExpressionStatement",
|
|
"span": {
|
|
"start": 292,
|
|
"end": 303,
|
|
"ctxt": 0
|
|
},
|
|
"expression": {
|
|
"type": "AssignmentExpression",
|
|
"span": {
|
|
"start": 292,
|
|
"end": 302,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 292,
|
|
"end": 298,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "ThisExpression",
|
|
"span": {
|
|
"start": 292,
|
|
"end": 296,
|
|
"ctxt": 0
|
|
}
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 297,
|
|
"end": 298,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 301,
|
|
"end": 302,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": null
|
|
}
|
|
},
|
|
{
|
|
"type": "ImportDeclaration",
|
|
"span": {
|
|
"start": 336,
|
|
"end": 367,
|
|
"ctxt": 0
|
|
},
|
|
"specifiers": [
|
|
{
|
|
"type": "ImportSpecifier",
|
|
"span": {
|
|
"start": 344,
|
|
"end": 349,
|
|
"ctxt": 0
|
|
},
|
|
"local": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 344,
|
|
"end": 349,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Point",
|
|
"optional": false
|
|
},
|
|
"imported": null,
|
|
"isTypeOnly": false
|
|
}
|
|
],
|
|
"source": {
|
|
"type": "StringLiteral",
|
|
"span": {
|
|
"start": 356,
|
|
"end": 366,
|
|
"ctxt": 0
|
|
},
|
|
"value": "./source",
|
|
"raw": "\"./source\""
|
|
},
|
|
"typeOnly": false,
|
|
"with": null
|
|
},
|
|
{
|
|
"type": "ExportDeclaration",
|
|
"span": {
|
|
"start": 397,
|
|
"end": 472,
|
|
"ctxt": 0
|
|
},
|
|
"declaration": {
|
|
"type": "FunctionDeclaration",
|
|
"identifier": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 413,
|
|
"end": 422,
|
|
"ctxt": 0
|
|
},
|
|
"value": "magnitude",
|
|
"optional": false
|
|
},
|
|
"declare": false,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"span": {
|
|
"start": 423,
|
|
"end": 424,
|
|
"ctxt": 0
|
|
},
|
|
"decorators": [],
|
|
"pat": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 423,
|
|
"end": 424,
|
|
"ctxt": 0
|
|
},
|
|
"value": "p",
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
}
|
|
}
|
|
],
|
|
"decorators": [],
|
|
"span": {
|
|
"start": 404,
|
|
"end": 472,
|
|
"ctxt": 0
|
|
},
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"span": {
|
|
"start": 426,
|
|
"end": 472,
|
|
"ctxt": 0
|
|
},
|
|
"stmts": [
|
|
{
|
|
"type": "ReturnStatement",
|
|
"span": {
|
|
"start": 432,
|
|
"end": 470,
|
|
"ctxt": 0
|
|
},
|
|
"argument": {
|
|
"type": "CallExpression",
|
|
"span": {
|
|
"start": 439,
|
|
"end": 469,
|
|
"ctxt": 0
|
|
},
|
|
"callee": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 439,
|
|
"end": 448,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 439,
|
|
"end": 443,
|
|
"ctxt": 0
|
|
},
|
|
"value": "Math",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 444,
|
|
"end": 448,
|
|
"ctxt": 0
|
|
},
|
|
"value": "sqrt",
|
|
"optional": false
|
|
}
|
|
},
|
|
"arguments": [
|
|
{
|
|
"spread": null,
|
|
"expression": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 468,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "+",
|
|
"left": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 457,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "**",
|
|
"left": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 452,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 449,
|
|
"end": 450,
|
|
"ctxt": 0
|
|
},
|
|
"value": "p",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 451,
|
|
"end": 452,
|
|
"ctxt": 0
|
|
},
|
|
"value": "x",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 456,
|
|
"end": 457,
|
|
"ctxt": 0
|
|
},
|
|
"value": 2.0,
|
|
"raw": "2"
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "BinaryExpression",
|
|
"span": {
|
|
"start": 460,
|
|
"end": 468,
|
|
"ctxt": 0
|
|
},
|
|
"operator": "**",
|
|
"left": {
|
|
"type": "MemberExpression",
|
|
"span": {
|
|
"start": 460,
|
|
"end": 463,
|
|
"ctxt": 0
|
|
},
|
|
"object": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 460,
|
|
"end": 461,
|
|
"ctxt": 0
|
|
},
|
|
"value": "p",
|
|
"optional": false
|
|
},
|
|
"property": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 462,
|
|
"end": 463,
|
|
"ctxt": 0
|
|
},
|
|
"value": "y",
|
|
"optional": false
|
|
}
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"span": {
|
|
"start": 467,
|
|
"end": 468,
|
|
"ctxt": 0
|
|
},
|
|
"value": 2.0,
|
|
"raw": "2"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"typeArguments": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"typeParameters": null,
|
|
"returnType": null
|
|
}
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|