Guest User

Untitled

a guest
Jun 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public abstract class ExtDepthFirstVisitor<T, S> : DepthFirstAstVisitor<T, S>
  2. {
  3. protected abstract S PreVisit(AstNode node, T data);
  4. protected abstract S PostVisit(AstNode node, T data);
  5.  
  6. protected override S VisitChildren(AstNode node, T data)
  7. {
  8. PreVisit(node, data);
  9.  
  10. AstNode next;
  11. for (var child = node.FirstChild; child != null; child = next)
  12. {
  13. // Store next to allow the loop to continue
  14. // if the visitor removes/replaces child.
  15. next = child.NextSibling;
  16. child.AcceptVisitor(this, data);
  17. }
  18.  
  19. PostVisit(node, data);
  20.  
  21. return default(S);
  22. }
  23. }
Add Comment
Please, Sign In to add comment