Browse Source

Added IsInside methods to the AstNode.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
b0332c6d9d
  1. 16
      ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

16
ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

@ -135,6 +135,22 @@ namespace ICSharpCode.NRefactory.CSharp @@ -135,6 +135,22 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
/// <summary>
/// Returns true, if the given coordinates are in the node.
/// </summary>
public bool IsInside (TextLocation location)
{
return StartLocation <= location && location <= EndLocation;
}
/// <summary>
/// Returns true, if the given coordinates (line, column) are in the node.
/// </summary>
public bool IsInside(int line, int column)
{
return IsInside(new TextLocation (line, column));
}
/// <summary>
/// Gets the region from StartLocation to EndLocation for this node.
/// The file name of the region is set based on the parent CompilationUnit's file name.

Loading…
Cancel
Save