Failure to properly parenthize short form of arrow function
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
When printing the following AST:
``` js
var recast = require('recast');
console.log(recast.print({
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "fn"
},
"right": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ArrowFunctionExpression",
"id": null,
"params": [],
"defaults": [],
"body": {
"type": "Identifier",
"name": "a"
},
"generator": false,
"expression": true
},
"property": {
"type": "Identifier",
"name": "bind"
}
},
"arguments": [
{
"type": "ThisExpression"
}
]
}
}
}).code);
```
expected output:
``` js
fn = (() => a).bind(this);
```
actual output:
``` js
fn = () => a.bind(this);
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the AST and recast.print example from the report. Inspect the arrow-function and member-expression printing paths involved in producing the output. Done means the example prints `fn = (() => a).bind(this);` rather than binding the call to `a`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100