Browse Source

Moved class type to IType / added type parameter class type for type

parameters.
newNRvisualizers
Mike Krüger 15 years ago
parent
commit
ba335edeb6
  1. 1
      ICSharpCode.NRefactory/TypeSystem/ClassType.cs
  2. 6
      ICSharpCode.NRefactory/TypeSystem/IType.cs
  3. 2
      ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs
  4. 7
      ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs
  5. 6
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeParameter.cs
  6. 4
      ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs

1
ICSharpCode.NRefactory/TypeSystem/ClassType.cs

@ -7,6 +7,7 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -7,6 +7,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
{
public enum ClassType : byte
{
TypeParameter,
Class,
Enum,
Interface,

6
ICSharpCode.NRefactory/TypeSystem/IType.cs

@ -22,13 +22,17 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -22,13 +22,17 @@ namespace ICSharpCode.NRefactory.TypeSystem
/// </returns>
bool? IsReferenceType { get; }
/// <summary>
/// Gets the type of the class.
/// </summary>
ClassType ClassType { get; }
/// <summary>
/// Gets the underlying type definition.
/// Can return null for types which do not have a type definition (for example arrays, pointers, type parameters)
/// </summary>
ITypeDefinition GetDefinition();
/// <summary>
/// Gets the parent type, if this is a nested type.
/// Returns null for top-level types.
/// </summary>

2
ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs

@ -15,8 +15,6 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -15,8 +15,6 @@ namespace ICSharpCode.NRefactory.TypeSystem
#endif
public interface ITypeDefinition : IType, IEntity
{
ClassType ClassType { get; }
IList<ITypeReference> BaseTypes { get; }
IList<ITypeParameter> TypeParameters { get; }

7
ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs

@ -44,6 +44,13 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -44,6 +44,13 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get { return null; }
}
public virtual ClassType ClassType {
get {
var definition = GetDefinition ();
return definition != null ? definition.ClassType : ClassType.Class;
}
}
public virtual ITypeDefinition GetDefinition()
{
return null;

6
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeParameter.cs

@ -84,6 +84,12 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -84,6 +84,12 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
}
}
ClassType IType.ClassType {
get {
return ClassType.TypeParameter;
}
}
int IType.TypeParameterCount {
get { return 0; }
}

4
ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs

@ -94,6 +94,10 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -94,6 +94,10 @@ namespace ICSharpCode.NRefactory.TypeSystem
}
}
public ClassType ClassType {
get { return genericType.ClassType; }
}
public int TypeParameterCount {
get { return genericType.TypeParameterCount; }
}

Loading…
Cancel
Save