Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 'forin' check recognize negative checks with continue
This patch modifies the 'forin' check so that it correctly recognizes negative conditional checks using continue. For example: for (var key in collection) { if (! collection.hasOwnProperty(key)) { continue; } doSomething(); } The conditional itself is not analyzed beyond checking whether it starts with a negation operator or not. Results of the if analysis are stored in a stack that is evaluated after the for loop was parsed completely. As a result, the improved check also works for nested loops. References: Closes GH-229
- Loading branch information
Showing
3 changed files
with
111 additions
and
8 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
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