@@ -780,16 +780,17 @@ class ResultBuilderTransform
780
780
#undef UNSUPPORTED_STMT
781
781
782
782
private:
783
- static bool isBuildableIfChainRecursive (IfStmt *ifStmt, unsigned &numPayloads,
784
- bool &isOptional) {
783
+ static void checkBuildableIfChainRecursive (IfStmt *ifStmt,
784
+ unsigned &numPayloads,
785
+ bool &isOptional) {
785
786
// The 'then' clause contributes a payload.
786
787
++numPayloads;
787
788
788
789
// If there's an 'else' clause, it contributes payloads:
789
790
if (auto elseStmt = ifStmt->getElseStmt ()) {
790
791
// If it's 'else if', it contributes payloads recursively.
791
792
if (auto elseIfStmt = dyn_cast<IfStmt>(elseStmt)) {
792
- return isBuildableIfChainRecursive (elseIfStmt, numPayloads, isOptional);
793
+ checkBuildableIfChainRecursive (elseIfStmt, numPayloads, isOptional);
793
794
// Otherwise it's just the one.
794
795
} else {
795
796
++numPayloads;
@@ -799,8 +800,6 @@ class ResultBuilderTransform
799
800
} else {
800
801
isOptional = true ;
801
802
}
802
-
803
- return true ;
804
803
}
805
804
806
805
static bool hasUnconditionalElse (IfStmt *ifStmt) {
@@ -815,8 +814,7 @@ class ResultBuilderTransform
815
814
816
815
bool isBuildableIfChain (IfStmt *ifStmt, unsigned &numPayloads,
817
816
bool &isOptional) {
818
- if (!isBuildableIfChainRecursive (ifStmt, numPayloads, isOptional))
819
- return false ;
817
+ checkBuildableIfChainRecursive (ifStmt, numPayloads, isOptional);
820
818
821
819
// If there's a missing 'else', we need 'buildOptional' to exist.
822
820
if (isOptional && !builder.supportsOptional ())
0 commit comments