-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic/InlineControlStructure: remove redundant condition
This commit removes a redundant condition that was added in fbea319 to support JS braceless do-while loops. A subsequent commit added similar code to support braceless do-while loops (plus for/while loops without body) for PHP, but it also works for JS (13c803b). There are a few syntax error cases that were handled by the code that is removed by this commit and are not handled by the code introduced in 13c803b. Without the removed code, they are now handled in a if condition right below. I added two tests with those cases to ensure the sniff continues working as expected.
- Loading branch information
1 parent
38b4646
commit 9168f53
Showing
3 changed files
with
10 additions
and
15 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
5 changes: 5 additions & 0 deletions
5
src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.2.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Intentional parse error (missing closing parenthesis). | ||
// This should be the only test in this file. | ||
// Testing that the sniff is *not* triggered. | ||
|
||
do i++; while (i < 5 |
5 changes: 5 additions & 0 deletions
5
src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.3.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Intentional parse error (missing opening parenthesis). | ||
// This should be the only test in this file. | ||
// Testing that the sniff is *not* triggered. | ||
|
||
do i++; while |