Browse Source

Readded the 'IsInside' function that checks the position inclusive the

end location.
newNRvisualizers
Mike Krüger 14 years ago
parent
commit
11ab326cc3
  1. 24
      ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

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

@ -651,7 +651,7 @@ namespace ICSharpCode.NRefactory.CSharp
/// Returns true, if the given coordinates (line, column) are in the node. /// Returns true, if the given coordinates (line, column) are in the node.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// True, if the given coordinates are between StartLocation and EndLocation (inclusive); otherwise, false. /// True, if the given coordinates are between StartLocation and EndLocation (exclusive); otherwise, false.
/// </returns> /// </returns>
public bool Contains (int line, int column) public bool Contains (int line, int column)
{ {
@ -669,6 +669,28 @@ namespace ICSharpCode.NRefactory.CSharp
return this.StartLocation <= location && location < this.EndLocation; return this.StartLocation <= location && location < this.EndLocation;
} }
/// <summary>
/// Returns true, if the given coordinates (line, column) are in the node.
/// </summary>
/// <returns>
/// True, if the given coordinates are between StartLocation and EndLocation (inclusive); otherwise, false.
/// </returns>
public bool IsInside (int line, int column)
{
return IsInside (new TextLocation (line, column));
}
/// <summary>
/// Returns true, if the given coordinates are in the node.
/// </summary>
/// <returns>
/// True, if location is between StartLocation and EndLocation (inclusive); otherwise, false.
/// </returns>
public bool IsInside (TextLocation location)
{
return this.StartLocation <= location && location <= this.EndLocation;
}
public override void AddAnnotation (object annotation) public override void AddAnnotation (object annotation)
{ {
if (this.IsNull) if (this.IsNull)

Loading…
Cancel
Save