-
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
staticcheck: improve extractConsts helper
In commit ae60410 we changed extractConsts to not collect all distinct constants from phi nodes. We didn't notice that the function no longer returned more than one constant and didn't need to return a slice anymore. In this change, we change the signature and name, and replace all looping with a single if != nil check. Additionally, we introduce the extractConstExpectKind helper, which takes care of checking that the constant is of the right kind, and not untyped nil. This helper removes a lot of boilerplate. (cherry picked from commit 1735532)
- Loading branch information
Showing
2 changed files
with
19 additions
and
47 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