mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SR-5740 Refactoring action to convert if statement to switch
This commit is contained in:
@@ -2249,7 +2249,7 @@ isApplicable(ResolvedRangeInfo Info, DiagnosticEngine &Diag) {
|
||||
class ConditionalChecker : public ASTWalker {
|
||||
public:
|
||||
bool ParamsUseSameVars = true;
|
||||
bool ConditionUseOnlyAllowedFunctions = true;
|
||||
bool ConditionUseOnlyAllowedFunctions = false;
|
||||
StringRef ExpectName;
|
||||
|
||||
Expr *walkToExprPost(Expr *E) {
|
||||
@@ -2336,6 +2336,8 @@ isApplicable(ResolvedRangeInfo Info, DiagnosticEngine &Diag) {
|
||||
bool check(StmtConditionElement ConditionElement) {
|
||||
if (ConditionElement.getKind() == StmtConditionElement::CK_Availability)
|
||||
return false;
|
||||
if (ConditionElement.getKind() == StmtConditionElement::CK_PatternBinding)
|
||||
checker.ConditionUseOnlyAllowedFunctions = true;
|
||||
ConditionElement.walk(checker);
|
||||
return checker.allCheckPassed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user