statemachine: Move invariant code out of loop body

The lca variable doesn't change inside the loop. Comparing our
implementation to the algorithm in the SCXML spec reveals that this
check should indeed be done outside the loop.

Change-Id: I5e9824758fd147766e975d107a73561bd7f5a190
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
Kent Hansen 2012-07-12 01:01:17 +02:00 committed by Qt by Nokia
parent 5b87b6eda3
commit b76014b8ef

View File

@ -517,12 +517,12 @@ QList<QAbstractState*> QStateMachinePrivate::computeStatesToEnter(const QList<QA
for (int j = src ? 1 : 0; j < lst.size(); ++j) {
QAbstractState *s = lst.at(j);
addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
if (isParallel(lca)) {
QList<QAbstractState*> lcac = QStatePrivate::get(lca)->childStates();
foreach (QAbstractState* child,lcac) {
if (!statesToEnter.contains(child))
addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry);
}
}
if (isParallel(lca)) {
QList<QAbstractState*> lcac = QStatePrivate::get(lca)->childStates();
foreach (QAbstractState* child,lcac) {
if (!statesToEnter.contains(child))
addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry);
}
}
}