-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FIX]] Do not warn about non-ambiguous linebreaks
Warning W014 was implemented to alert users of potentially-confusing formatting resulting from reliance on ASI. The original heuristic was applied for every expression and simply referenced token values. It assumed that when the previous token was a closing parenthesis or bracket, this always signified a line of code where the newline could be interpreted as a statement boundary, e.g. x = 3 * (2 + 1) [0] However, this heuristic was susceptible to false positives, where the closing punctuator would not be interpreted as the end of a statement: if (true) [x] = [] Re-implement the code that detects the warning condition from the general "expression" function to the specific "infix" parsing logic (used only when the "(" and "[" tokens have been identified as components of an exiting expression).
- Loading branch information
1 parent
eaca85b
commit ab3ab85
Showing
2 changed files
with
31 additions
and
11 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