-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make path.needsParens(true) ignore statement parsing ambiguities.
As @spicyj pointed out in benjamn/recast#81 (comment), the NodePath.prototype.needsParens method has been conflating precedence logic with garden-path parser lookahead quirks. Rather than removing that edge case logic from the function, I have made it possible to skip the canBeFirstInStatement/firstInStatement checks by explicitly passing true to needsParens. Since the behavior of needsParens differs only if client code passes true for the assumeExpressionContext parameter, this change is completely backwards-compatible and does not require a minor version bump.
- Loading branch information
Showing
2 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters