Refactor: Get rid of isTrue variable in the while block execution

This commit is contained in:
Alex Turbov
2021-08-10 01:19:56 +03:00
committed by Brad King
parent 4c1cdfd8f0
commit eae125ace5

View File

@@ -81,12 +81,10 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
std::string errorString;
MessageType messageType;
auto isTrue = true;
for (cmConditionEvaluator conditionEvaluator(mf, whileBT);
(isTrue =
conditionEvaluator.IsTrue(expandArgs(this->Args, expandedArguments),
errorString, messageType));) {
conditionEvaluator.IsTrue(expandArgs(this->Args, expandedArguments),
errorString, messageType);) {
// Invoke all the functions that were collected in the block.
for (cmListFileFunction const& fn : functions) {
cmExecutionStatus status(mf);
@@ -107,7 +105,7 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
}
}
if (!isTrue && !errorString.empty()) {
if (!errorString.empty()) {
std::string err = "had incorrect arguments:\n ";
for (auto const& i : expandedArguments) {
err += " ";