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

470 lines
13 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 191,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 16,
"end": 53,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 20,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 20,
"end": 22,
"ctxt": 0
},
"value": "f1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 25,
"end": 52,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 31,
"end": 52,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 37,
"end": 50,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 37,
"end": 50,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 37,
"end": 45,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 37,
"end": 41,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"value": "age",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 48,
"end": 50,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 55,
"end": 100,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 59,
"end": 100,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 59,
"end": 61,
"ctxt": 0
},
"value": "f2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 64,
"end": 100,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 65,
"end": 74,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 66,
"end": 74,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 68,
"end": 74,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 79,
"end": 100,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 85,
"end": 98,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 85,
"end": 98,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 85,
"end": 94,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 85,
"end": 89,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 90,
"end": 94,
"ctxt": 0
},
"value": "name",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 111,
"end": 114,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 115,
"end": 134,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 115,
"end": 134,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 119,
"end": 134,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 121,
"end": 134,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 124,
"end": 134,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 134,
"ctxt": 0
},
"kind": "boolean"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 102,
"end": 138,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 139,
"end": 191,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 139,
"end": 190,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 139,
"end": 142,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 143,
"end": 189,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 149,
"end": 189,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 155,
"end": 170,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 155,
"end": 169,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 155,
"end": 163,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 155,
"end": 159,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 160,
"end": 163,
"ctxt": 0
},
"value": "age",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
},
{
"type": "ReturnStatement",
"span": {
"start": 175,
"end": 187,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 182,
"end": 186,
"ctxt": 0
},
"value": true
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}