Skip to content

Commit a9084d4

Browse files
committed
[Refactoring] Remove ConditionType::INVALID
This will make it a little nicer to switch on ConditionType.
1 parent 913da06 commit a9084d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/IDE/Refactoring.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4427,12 +4427,12 @@ struct AsyncHandlerParamDesc : public AsyncHandlerDesc {
44274427
}
44284428
};
44294429

4430-
enum class ConditionType { INVALID, NIL, NOT_NIL };
4430+
enum class ConditionType { NIL, NOT_NIL };
44314431

44324432
/// Finds the `Subject` being compared to in various conditions. Also finds any
44334433
/// pattern that may have a bound name.
44344434
struct CallbackCondition {
4435-
ConditionType Type = ConditionType::INVALID;
4435+
Optional<ConditionType> Type;
44364436
const Decl *Subject = nullptr;
44374437
const Pattern *BindPattern = nullptr;
44384438
// Bit of a hack. When the `Subject` is a `Result` type we use this to
@@ -4504,7 +4504,7 @@ struct CallbackCondition {
45044504
}
45054505
}
45064506

4507-
bool isValid() const { return Type != ConditionType::INVALID; }
4507+
bool isValid() const { return Type.hasValue(); }
45084508

45094509
/// Given an `if` condition `Cond` and a set of `Decls`, find any
45104510
/// `CallbackCondition`s in `Cond` that use one of those `Decls` and add them
@@ -4902,10 +4902,10 @@ struct CallbackClassifier {
49024902
ThenBlock = ElseBlock;
49034903
ElseBlock = TempBlock;
49044904
} else {
4905-
ConditionType CondType = ConditionType::INVALID;
4905+
Optional<ConditionType> CondType;
49064906
for (auto &Entry : CallbackConditions) {
49074907
if (IsResultParam || Entry.second.Subject != ErrParam) {
4908-
if (CondType == ConditionType::INVALID) {
4908+
if (!CondType) {
49094909
CondType = Entry.second.Type;
49104910
} else if (CondType != Entry.second.Type) {
49114911
// Similar to the unknown conditions case. Add the whole if unless

0 commit comments

Comments
 (0)