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
{ {
public enum ClassType : byte public enum ClassType : byte
{ {
TypeParameter,
Class, Class,
Enum, Enum,
Interface, Interface,

6
ICSharpCode.NRefactory/TypeSystem/IType.cs

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

2
ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs

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

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

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

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

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

4
ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs

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

Loading…
Cancel
Save