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 {
|
namespace Tasking {
|
||||||
|
|
||||||
static Group conditionRecipe(const Storage<bool> &bodyExecutedStorage,
|
static Group conditionRecipe(const Storage<bool> &bodyExecutedStorage, const ConditionData &condition)
|
||||||
const ConditionData &condition)
|
|
||||||
{
|
{
|
||||||
Storage<bool> skipContinuationStorage;
|
const Storage<bool> doExecuteBodyStorage(true);
|
||||||
|
|
||||||
const auto onSetup = [bodyExecutedStorage] {
|
const auto onSetup = [bodyExecutedStorage] {
|
||||||
return *bodyExecutedStorage ? SetupResult::StopWithSuccess : SetupResult::Continue;
|
return *bodyExecutedStorage ? SetupResult::StopWithSuccess : SetupResult::Continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto onConditionDone = [skipContinuationStorage](DoneWith result) {
|
const auto onConditionDone = [doExecuteBodyStorage](DoneWith result) {
|
||||||
*skipContinuationStorage = result != DoneWith::Success;
|
*doExecuteBodyStorage = result == DoneWith::Success;
|
||||||
return DoneResult::Success;
|
return DoneResult::Success;
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto onContinuationSetup = [skipContinuationStorage, bodyExecutedStorage] {
|
const auto onContinuationSetup = [doExecuteBodyStorage, bodyExecutedStorage] {
|
||||||
*bodyExecutedStorage = !*skipContinuationStorage;
|
*bodyExecutedStorage = *doExecuteBodyStorage;
|
||||||
return *skipContinuationStorage ? SetupResult::StopWithSuccess : SetupResult::Continue;
|
return *doExecuteBodyStorage ? SetupResult::Continue : SetupResult::StopWithSuccess;
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
skipContinuationStorage,
|
doExecuteBodyStorage,
|
||||||
onGroupSetup(onSetup),
|
onGroupSetup(onSetup),
|
||||||
condition.m_condition ? Group {
|
condition.m_condition ? Group {
|
||||||
*condition.m_condition,
|
*condition.m_condition,
|
||||||
|
Reference in New Issue
Block a user