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

511 lines
13 KiB
JSON

{
"type": "Module",
"span": {
"start": 91,
"end": 413,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 91,
"end": 227,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"value": "Crunch",
"optional": false
},
"declare": false,
"span": {
"start": 98,
"end": 227,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 146,
"end": 187,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 146,
"end": 157,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 161,
"end": 187,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 171,
"end": 181,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 171,
"end": 181,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 171,
"end": 177,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 171,
"end": 175,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "n",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 192,
"end": 225,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "m",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 192,
"end": 225,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 196,
"end": 225,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 206,
"end": 219,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 213,
"end": 217,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "n",
"optional": 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": 250,
"end": 274,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 254,
"end": 274,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 254,
"end": 256,
"ctxt": 0
},
"value": "ex",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 259,
"end": 274,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 259,
"end": 266,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 267,
"end": 273,
"ctxt": 0
},
"value": "./ex",
"raw": "'./ex'"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 291,
"end": 321,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 295,
"end": 320,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 295,
"end": 301,
"ctxt": 0
},
"value": "crunch",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 304,
"end": 320,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 308,
"end": 317,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 308,
"end": 310,
"ctxt": 0
},
"value": "ex",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 311,
"end": 317,
"ctxt": 0
},
"value": "Crunch",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 322,
"end": 330,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 322,
"end": 330,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 322,
"end": 328,
"ctxt": 0
},
"value": "crunch",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 391,
"end": 392,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 393,
"end": 397,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 393,
"end": 397,
"ctxt": 0
},
"value": "wrap",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 382,
"end": 413,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 399,
"end": 413,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 405,
"end": 411,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 405,
"end": 411,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 405,
"end": 409,
"ctxt": 0
},
"value": "wrap",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 410,
"end": 411,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}