diff --git a/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs b/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs index da2a6c06af..cc4129947b 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.Utils; +using ICSharpCode.NRefactory.CSharp.Refactoring; +using ICSharpCode.NRefactory.CSharp; namespace ICSharpCode.NRefactory.TypeSystem { @@ -217,5 +219,25 @@ namespace ICSharpCode.NRefactory.TypeSystem return TreeTraversal.PreOrder(context.GetClasses(), t => t.InnerClasses); } #endregion + + #region GetType/Member + /// + /// Gets the type (potentially a nested type) defined at the specified location. + /// Returns null if no type is defined at that location. + /// + public static ITypeDefinition GetTypeDefinition (this IParsedFile file, int line, int column) + { + return file.GetTypeDefinition (new AstLocation (line, column)); + } + + /// + /// Gets the member defined at the specified location. + /// Returns null if no member is defined at that location. + /// + public static IMember GetMember (this IParsedFile file, int line, int column) + { + return file.GetMember (new AstLocation (line, column)); + } + #endregion } }