Browse Source

add icon margin & bookmarks

newNRvisualizers
Eusebiu Marcu 14 years ago
parent
commit
a7f45f683a
  1. 18
      ICSharpCode.NRefactory/CSharp/Ast/CompilationUnit.cs

18
ICSharpCode.NRefactory/CSharp/Ast/CompilationUnit.cs

@ -25,6 +25,9 @@ @@ -25,6 +25,9 @@
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.NRefactory.Utils;
namespace ICSharpCode.NRefactory.CSharp
{
@ -101,6 +104,21 @@ namespace ICSharpCode.NRefactory.CSharp @@ -101,6 +104,21 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
/// <summary>
/// Gets all nodes in that are satisfing a predicate.
/// </summary>
/// <param name="predicate">Predicate to filter the nodes.</param>
/// <returns></returns>
public IEnumerable<AstNode> GetNodesWithLineNumbers(Predicate<AstNode> predicate)
{
if (predicate == null)
throw new ArgumentNullException("predicate");
return TreeTraversal
.PreOrder((AstNode)this, n => n.Children)
.Where(n => predicate(n) && n.Annotation<Tuple<int, int>>() != null);
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitCompilationUnit (this, data);

Loading…
Cancel
Save