// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.VB.Visitors
{
///
/// Sets the parent property on all nodes in the tree.
///
public class SetParentVisitor : NodeTrackingDomVisitor
{
Stack nodeStack = new Stack();
public SetParentVisitor()
{
nodeStack.Push(null);
}
protected override void BeginVisit(INode node)
{
node.Parent = nodeStack.Peek();
nodeStack.Push(node);
}
protected override void EndVisit(INode node)
{
nodeStack.Pop();
}
}
}