.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
789 B

// 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
{
/// <summary>
/// Sets the parent property on all nodes in the tree.
/// </summary>
public class SetParentVisitor : NodeTrackingDomVisitor
{
Stack<INode> nodeStack = new Stack<INode>();
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();
}
}
}