@@ -780,16 +780,17 @@ class ResultBuilderTransform
780780#undef UNSUPPORTED_STMT
781781
782782private:
783- static bool isBuildableIfChainRecursive (IfStmt *ifStmt, unsigned &numPayloads,
784- bool &isOptional) {
783+ static void checkBuildableIfChainRecursive (IfStmt *ifStmt,
784+ unsigned &numPayloads,
785+ bool &isOptional) {
785786 // The 'then' clause contributes a payload.
786787 ++numPayloads;
787788
788789 // If there's an 'else' clause, it contributes payloads:
789790 if (auto elseStmt = ifStmt->getElseStmt ()) {
790791 // If it's 'else if', it contributes payloads recursively.
791792 if (auto elseIfStmt = dyn_cast<IfStmt>(elseStmt)) {
792- return isBuildableIfChainRecursive (elseIfStmt, numPayloads, isOptional);
793+ checkBuildableIfChainRecursive (elseIfStmt, numPayloads, isOptional);
793794 // Otherwise it's just the one.
794795 } else {
795796 ++numPayloads;
@@ -799,8 +800,6 @@ class ResultBuilderTransform
799800 } else {
800801 isOptional = true ;
801802 }
802-
803- return true ;
804803 }
805804
806805 static bool hasUnconditionalElse (IfStmt *ifStmt) {
@@ -815,8 +814,7 @@ class ResultBuilderTransform
815814
816815 bool isBuildableIfChain (IfStmt *ifStmt, unsigned &numPayloads,
817816 bool &isOptional) {
818- if (!isBuildableIfChainRecursive (ifStmt, numPayloads, isOptional))
819- return false ;
817+ checkBuildableIfChainRecursive (ifStmt, numPayloads, isOptional);
820818
821819 // If there's a missing 'else', we need 'buildOptional' to exist.
822820 if (isOptional && !builder.supportsOptional ())
0 commit comments