forked from qt-creator/qt-creator
TaskTree: Make conditional internals a bit more readable
Reuse the newly introduced c'tor of the Storage taking the init data. Change-Id: I3ac91236d9e8180628518f546335144c26915c79 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -8,27 +8,26 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace Tasking {
|
||||
|
||||
static Group conditionRecipe(const Storage<bool> &bodyExecutedStorage,
|
||||
const ConditionData &condition)
|
||||
static Group conditionRecipe(const Storage<bool> &bodyExecutedStorage, const ConditionData &condition)
|
||||
{
|
||||
Storage<bool> skipContinuationStorage;
|
||||
const Storage<bool> doExecuteBodyStorage(true);
|
||||
|
||||
const auto onSetup = [bodyExecutedStorage] {
|
||||
return *bodyExecutedStorage ? SetupResult::StopWithSuccess : SetupResult::Continue;
|
||||
};
|
||||
|
||||
const auto onConditionDone = [skipContinuationStorage](DoneWith result) {
|
||||
*skipContinuationStorage = result != DoneWith::Success;
|
||||
const auto onConditionDone = [doExecuteBodyStorage](DoneWith result) {
|
||||
*doExecuteBodyStorage = result == DoneWith::Success;
|
||||
return DoneResult::Success;
|
||||
};
|
||||
|
||||
const auto onContinuationSetup = [skipContinuationStorage, bodyExecutedStorage] {
|
||||
*bodyExecutedStorage = !*skipContinuationStorage;
|
||||
return *skipContinuationStorage ? SetupResult::StopWithSuccess : SetupResult::Continue;
|
||||
const auto onContinuationSetup = [doExecuteBodyStorage, bodyExecutedStorage] {
|
||||
*bodyExecutedStorage = *doExecuteBodyStorage;
|
||||
return *doExecuteBodyStorage ? SetupResult::Continue : SetupResult::StopWithSuccess;
|
||||
};
|
||||
|
||||
return {
|
||||
skipContinuationStorage,
|
||||
doExecuteBodyStorage,
|
||||
onGroupSetup(onSetup),
|
||||
condition.m_condition ? Group {
|
||||
*condition.m_condition,
|
||||
|
Reference in New Issue
Block a user