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

468 lines
12 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 15,
"end": 190,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 15,
"end": 52,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 19,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 19,
"end": 21,
"ctxt": 0
},
"value": "f1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 24,
"end": 51,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 30,
"end": 51,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 36,
"end": 49,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 36,
"end": 49,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 36,
"end": 44,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 36,
"end": 40,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"value": "age",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 47,
"end": 49,
"ctxt": 0
},
"value": 10.0
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 54,
"end": 99,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 58,
"end": 99,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 58,
"end": 60,
"ctxt": 0
},
"value": "f2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 63,
"end": 99,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 64,
"end": 73,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 65,
"end": 73,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 67,
"end": 73,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 78,
"end": 99,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 84,
"end": 97,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 84,
"end": 97,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 89,
"end": 93,
"ctxt": 0
},
"value": "name",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 96,
"end": 97,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 110,
"end": 113,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 114,
"end": 133,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 114,
"end": 133,
"ctxt": 0
},
"value": "func",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 118,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 120,
"end": 133,
"ctxt": 0
},
"params": [],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 123,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 126,
"end": 133,
"ctxt": 0
},
"kind": "boolean"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 101,
"end": 137,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 137,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 138,
"end": 190,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 138,
"end": 189,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 142,
"end": 188,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 148,
"end": 188,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 154,
"end": 169,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 154,
"end": 168,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 154,
"end": 162,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 154,
"end": 158,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 159,
"end": 162,
"ctxt": 0
},
"value": "age",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 165,
"end": 168,
"ctxt": 0
},
"value": 100.0
}
}
},
{
"type": "ReturnStatement",
"span": {
"start": 174,
"end": 186,
"ctxt": 0
},
"argument": {
"type": "BooleanLiteral",
"span": {
"start": 181,
"end": 185,
"ctxt": 0
},
"value": true
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}