SR-5740 Refactoring action to convert if statement to switch

This commit is contained in:
Vlasov Anton
2020-02-08 16:23:41 +03:00
parent 904bd0bf63
commit 6013431ecd
2 changed files with 17 additions and 1 deletions

View File

@@ -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();
}