|
|
|
@ -7,51 +7,27 @@ using System.Diagnostics.Contracts;
@@ -7,51 +7,27 @@ using System.Diagnostics.Contracts;
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.NRefactory.TypeSystem |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents a reference to a type.
|
|
|
|
|
/// Must be resolved before it can be used as type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ContractClass(typeof(ITypeReferenceContract))] |
|
|
|
|
public interface ITypeReference : IFreezable |
|
|
|
|
public interface ITypeReference |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves this type reference.
|
|
|
|
|
/// </summary>
|
|
|
|
|
IType Resolve(ITypeResolveContext context); |
|
|
|
|
// Keep this interface simple: I decided against having GetMethods/GetEvents etc. here,
|
|
|
|
|
// so that the Resolve step is never hidden from the consumer.
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the direct base types.
|
|
|
|
|
/// </summary>
|
|
|
|
|
IEnumerable<IType> GetBaseTypes(ITypeResolveContext context); |
|
|
|
|
// I decided against implementing IFreezable here: ITypeDefinition can be used as ITypeReference,
|
|
|
|
|
// but when freezing the reference, one wouldn't expect the definition to freeze.
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets inner classes (including inherited inner classes).
|
|
|
|
|
/// </summary>
|
|
|
|
|
IList<IType> GetNestedTypes(ITypeResolveContext context); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all methods that can be called on this return type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A new mutable list</returns>
|
|
|
|
|
IList<IMethod> GetMethods(ITypeResolveContext context); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all properties that can be called on this return type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A new mutable list</returns>
|
|
|
|
|
IList<IProperty> GetProperties(ITypeResolveContext context); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all fields that can be called on this return type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A new mutable list</returns>
|
|
|
|
|
IList<IField> GetFields(ITypeResolveContext context); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets all events that can be called on this return type.
|
|
|
|
|
/// Resolves this type reference.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A new mutable list</returns>
|
|
|
|
|
IList<IEvent> GetEvents(ITypeResolveContext context); |
|
|
|
|
IType Resolve(ITypeResolveContext context); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[ContractClassFor(typeof(ITypeReference))] |
|
|
|
|
abstract class ITypeReferenceContract : IFreezableContract, ITypeReference |
|
|
|
|
abstract class ITypeReferenceContract : ITypeReference |
|
|
|
|
{ |
|
|
|
|
IType ITypeReference.Resolve(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
@ -59,47 +35,5 @@ namespace ICSharpCode.NRefactory.TypeSystem
@@ -59,47 +35,5 @@ namespace ICSharpCode.NRefactory.TypeSystem
|
|
|
|
|
Contract.Ensures(Contract.Result<IType>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IEnumerable<IType> ITypeReference.GetBaseTypes(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
Contract.Requires(context != null); |
|
|
|
|
Contract.Ensures(Contract.Result<IEnumerable<IType>>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IList<IType> ITypeReference.GetNestedTypes(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
Contract.Requires(context != null); |
|
|
|
|
Contract.Ensures(Contract.Result<IList<IType>>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IList<IMethod> ITypeReference.GetMethods(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
Contract.Requires(context != null); |
|
|
|
|
Contract.Ensures(Contract.Result<IList<IMethod>>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IList<IProperty> ITypeReference.GetProperties(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
Contract.Requires(context != null); |
|
|
|
|
Contract.Ensures(Contract.Result<IList<IProperty>>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IList<IField> ITypeReference.GetFields(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
Contract.Requires(context != null); |
|
|
|
|
Contract.Ensures(Contract.Result<IList<IField>>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IList<IEvent> ITypeReference.GetEvents(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
Contract.Requires(context != null); |
|
|
|
|
Contract.Ensures(Contract.Result<IList<IEvent>>() != null); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |