Browse Source

Addded GetSubTypeDefinitions method.

That's like a routine we had in the old MD dom - it's used for example
for finding all exceptions in an assembly.
newNRvisualizers
Mike Krüger 15 years ago
parent
commit
c6aa05d35d
  1. 15
      ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs
  2. 2
      ICSharpCode.NRefactory/TypeSystem/IAnnotatable.cs

15
ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs

@ -252,6 +252,19 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -252,6 +252,19 @@ namespace ICSharpCode.NRefactory.TypeSystem
.Concat (type.GetMethods (context, filter).SafeCast<IMethod, IMember> ())
.Concat (type.GetEvents (context, filter).SafeCast<IEvent, IMember> ());
}
#endregion
#endregion
#region GetSubTypeDefinitions
/// <summary>
/// Gets all sub type definitions defined in a context.
/// </summary>
public static IEnumerable<ITypeDefinition> GetSubTypeDefinitions (this IType baseType, ITypeResolveContext context)
{
foreach (var contextType in context.GetAllClasses ()) {
if (contextType.IsDerivedFrom (baseType, context))
yield return contextType;
}
}
#endregion
}
}

2
ICSharpCode.NRefactory/TypeSystem/IAnnotatable.cs

@ -9,7 +9,7 @@ using System.Threading; @@ -9,7 +9,7 @@ using System.Threading;
namespace ICSharpCode.NRefactory
{
/// <summary>
/// Provides an interface to handle annotations in an objectj
/// Provides an interface to handle annotations in an object.
/// </summary>
public interface IAnnotatable
{

Loading…
Cancel
Save