Browse Source

Added gettype/member extension methods that are working on a

line/column pair.
newNRvisualizers
Mike Krüger 15 years ago
parent
commit
1ae1b17ea5
  1. 22
      ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs

22
ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs

@ -5,6 +5,8 @@ using System; @@ -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 @@ -217,5 +219,25 @@ namespace ICSharpCode.NRefactory.TypeSystem
return TreeTraversal.PreOrder(context.GetClasses(), t => t.InnerClasses);
}
#endregion
#region GetType/Member
/// <summary>
/// Gets the type (potentially a nested type) defined at the specified location.
/// Returns null if no type is defined at that location.
/// </summary>
public static ITypeDefinition GetTypeDefinition (this IParsedFile file, int line, int column)
{
return file.GetTypeDefinition (new AstLocation (line, column));
}
/// <summary>
/// Gets the member defined at the specified location.
/// Returns null if no member is defined at that location.
/// </summary>
public static IMember GetMember (this IParsedFile file, int line, int column)
{
return file.GetMember (new AstLocation (line, column));
}
#endregion
}
}

Loading…
Cancel
Save