Browse Source

Removed code duplication.

btw. was the worst case of duplication - the methods should do the
same but had slightly different semantics.
newNRvisualizers
mike 14 years ago
parent
commit
ab7a24e2f7
  1. 30
      ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

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

@ -154,22 +154,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -154,22 +154,6 @@ 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.
@ -663,14 +647,26 @@ namespace ICSharpCode.NRefactory.CSharp @@ -663,14 +647,26 @@ namespace ICSharpCode.NRefactory.CSharp
return w.ToString ();
}
/// <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 Contains (int line, int column)
{
return Contains (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 Contains (TextLocation location)
{
return this.StartLocation <= location && location < this.EndLocation;
return this.StartLocation <= location && location <= this.EndLocation;
}
public override void AddAnnotation (object annotation)

Loading…
Cancel
Save