//Common verifier behaviour for all node types override protected void DispatchNode(Node node, object data) { StackTypes stack = data as StackTypes; if (stack == null) { throw new VerifierException(); } StackTypes oldStack = GetNodeStack(node); if (oldStack == null) { SetNodeStack(node, stack); } else { if (Verifier.IsStackMoreGeneral(oldStack, stack)) { return; } stack = Verifier.DoMergeStacks(oldStack, stack); //throws VerifierException SetNodeStack(node, stack); } CallVisitorMethod(node, stack.Clone()); }
protected internal override void VisitBranch(Branch node, object data) { StackTypes stack = data as StackTypes; Verifier.ProcessBrTrueFalse(stack); AddTask(node.Next, stack); AddTask(node.Alt, stack.Clone()); }
protected internal override void VisitSwitch(Switch node, object data) { StackTypes stack = data as StackTypes; Verifier.ProcessSwitch(stack); AddTask(node.Next, stack); for (int i = 1; i < node.NextArray.Count; i++) { AddTask(node.NextArray[i], stack.Clone()); } }
/* Visiting methods */ protected internal override void VisitServiceNode(ServiceNode node, object data) { StackTypes stack = data as StackTypes; AddTask(node.Next, stack); for (int i = 1; i < node.NextArray.Count; i++) { AddTask(node.NextArray[i], stack.Clone()); } //Service nodes do not change the stack }