internal override void Execute(Processor processor, ActionFrame frame) {
Debug.Assert(processor != null && frame != null);
switch (frame.State) {
case Initialized:
if (this.type == ConditionType.ConditionIf || this.type == ConditionType.ConditionWhen) {
Debug.Assert(this.testKey != Compiler.InvalidQueryKey);
bool value = processor.EvaluateBoolean(frame, this.testKey);
if (value == false) {
frame.Finished();
break;
}
}
processor.PushActionFrame(frame);
frame.State = ProcessingChildren;
break; // Allow children to run
case ProcessingChildren:
if (this.type == ConditionType.ConditionWhen ||this.type == ConditionType.ConditionOtherwise) {
Debug.Assert(frame.Container != null);
frame.Exit();
}
frame.Finished();
break;
default:
Debug.Fail("Invalid IfAction execution state");
break;
}
}
}