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

514 lines
13 KiB
JSON

{
"type": "Module",
"span": {
"start": 90,
"end": 412,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 90,
"end": 226,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 103,
"end": 109,
"ctxt": 0
},
"value": "Crunch",
"optional": false
},
"declare": false,
"span": {
"start": 97,
"end": 226,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 145,
"end": 186,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 157,
"end": 158,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 157,
"end": 158,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 160,
"end": 186,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 170,
"end": 180,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 170,
"end": 180,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 170,
"end": 176,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 170,
"end": 174,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "n",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 191,
"end": 224,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "m",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 191,
"end": 224,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 195,
"end": 224,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 205,
"end": 218,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 212,
"end": 216,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"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": 249,
"end": 273,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 253,
"end": 273,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 253,
"end": 255,
"ctxt": 0
},
"value": "ex",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 258,
"end": 273,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 258,
"end": 265,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 266,
"end": 272,
"ctxt": 0
},
"value": "./ex",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 290,
"end": 320,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 294,
"end": 319,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 294,
"end": 300,
"ctxt": 0
},
"value": "crunch",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 303,
"end": 319,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 307,
"end": 316,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 307,
"end": 309,
"ctxt": 0
},
"value": "ex",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 310,
"end": 316,
"ctxt": 0
},
"value": "Crunch",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 317,
"end": 318,
"ctxt": 0
},
"value": 1.0
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 321,
"end": 329,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 329,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 321,
"end": 327,
"ctxt": 0
},
"value": "crunch",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 390,
"end": 391,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 392,
"end": 396,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 392,
"end": 396,
"ctxt": 0
},
"value": "wrap",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 381,
"end": 412,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 398,
"end": 412,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 404,
"end": 410,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 404,
"end": 410,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 404,
"end": 408,
"ctxt": 0
},
"value": "wrap",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 409,
"end": 410,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}