diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index a82beae640..8e6d05a2d4 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -135,6 +135,22 @@ namespace ICSharpCode.NRefactory.CSharp } } + /// + /// Returns true, if the given coordinates are in the node. + /// + public bool IsInside (TextLocation location) + { + return StartLocation <= location && location <= EndLocation; + } + + /// + /// Returns true, if the given coordinates (line, column) are in the node. + /// + public bool IsInside(int line, int column) + { + return IsInside(new TextLocation (line, column)); + } + /// /// 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.