File: ConvertVisitorBase.cs

package info (click to toggle)
monodevelop 2.4%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 54,088 kB
  • ctags: 67,523
  • sloc: cs: 436,824; xml: 18,137; makefile: 5,722; sh: 1,085; sed: 2
file content (28 lines) | stat: -rw-r--r-- 865 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
//     <version>$Revision: 4482 $</version>
// </file>

using System;
using ICSharpCode.NRefactory.Ast;

namespace ICSharpCode.NRefactory.Visitors
{
	/// <summary>
	/// Base class for the conversion visitors.
	/// </summary>
	public class ConvertVisitorBase : AbstractAstTransformer
	{
		// inserting before current position is not allowed in a Transformer
		// but inserting after it is possible
		protected void InsertAfterSibling(INode sibling, INode newNode)
		{
			if (sibling == null || sibling.Parent == null) return;
			int index = sibling.Parent.Children.IndexOf(sibling);
			sibling.Parent.Children.Insert(index + 1, newNode);
			newNode.Parent = sibling.Parent;
		}
	}
}