diff options
Diffstat (limited to 'src/control.cc')
-rw-r--r-- | src/control.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/control.cc b/src/control.cc index d0b96a1..5b7e1b1 100644 --- a/src/control.cc +++ b/src/control.cc @@ -149,12 +149,21 @@ AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstantiation if (type == IF) { - if (inst->argvalues.size() > 0 && inst->argvalues[0].type == Value::BOOL && inst->argvalues[0].b) - foreach (ModuleInstantiation *v, inst->children) { - AbstractNode *n = v->evaluate(inst->ctx); + const IfElseModuleInstantiation *ifelse = dynamic_cast<const IfElseModuleInstantiation*>(inst); + if (ifelse->argvalues.size() > 0 && ifelse->argvalues[0].type == Value::BOOL && ifelse->argvalues[0].b) { + foreach (ModuleInstantiation *v, ifelse->children) { + AbstractNode *n = v->evaluate(ifelse->ctx); if (n != NULL) node->children.append(n); } + } + else { + foreach (ModuleInstantiation *v, ifelse->else_children) { + AbstractNode *n = v->evaluate(ifelse->ctx); + if (n != NULL) + node->children.append(n); + } + } } return node; |