diff --git a/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs b/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs index 26425e2f43..184de64784 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs @@ -26,9 +26,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// Represents an unresolved attribute. /// - #if WITH_CONTRACTS - [ContractClass(typeof(IUnresolvedAttributeContract))] - #endif [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] public interface IUnresolvedAttribute { @@ -37,8 +34,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// DomRegion Region { get; } - //ITypeReference AttributeType { get; } - /// /// Resolves the attribute. /// @@ -48,9 +43,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// Represents an attribute. /// - #if WITH_CONTRACTS - [ContractClass(typeof(IAttributeContract))] - #endif [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] public interface IAttribute { @@ -80,41 +72,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// IList> NamedArguments { get; } } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IAttribute))] - abstract class IAttributeContract : IFreezableContract, IAttribute - { - DomRegion IAttribute.Region { - get { return DomRegion.Empty; } - } - - ITypeReference IAttribute.AttributeType { - get { - Contract.Ensures(Contract.Result() != null); - return null; - } - } - - IList IAttribute.GetPositionalArguments(ITypeResolveContext context) - { - Contract.Requires(context != null); - Contract.Ensures(Contract.Result>() != null); - return null; - } - - IList> IAttribute.GetNamedArguments(ITypeResolveContext context) - { - Contract.Requires(context != null); - Contract.Ensures(Contract.Result>>() != null); - return null; - } - - IMethod IAttribute.ResolveConstructor(ITypeResolveContext context) - { - Contract.Requires(context != null); - return null; - } - } - #endif } diff --git a/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs b/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs index e0b63a28ad..050d09e099 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs @@ -17,13 +17,9 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { - #if WITH_CONTRACTS - [ContractClass(typeof(IFreezableContract))] - #endif public interface IFreezable { /// @@ -36,20 +32,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// void Freeze(); } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IFreezable))] - abstract class IFreezableContract : IFreezable - { - bool IFreezable.IsFrozen { - get { return default(bool); } - } - - void IFreezable.Freeze() - { - IFreezable self = this; - Contract.Ensures(self.IsFrozen); - } - } - #endif } diff --git a/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs b/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs index dc20e18ef8..89edd7f9f4 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { @@ -40,9 +39,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// and which are used only within a single type definition. Then a persistent file format could be organized so /// that shared objects are loaded only once, yet non-shared objects get loaded lazily together with the class. /// - #if WITH_CONTRACTS - [ContractClass(typeof(IInterningProviderContract))] - #endif public interface IInterningProvider { /// @@ -55,22 +51,4 @@ namespace ICSharpCode.NRefactory.TypeSystem IList InternList(IList list) where T : class; } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IInterningProvider))] - abstract class IInterningProviderContract : IInterningProvider - { - T IInterningProvider.Intern(T obj) - { - Contract.Ensures((Contract.Result() == null) == (obj == null)); - return obj; - } - - IList IInterningProvider.InternList(IList list) - { - Contract.Ensures((Contract.Result>() == null) == (list == null)); - return list; - } - } - #endif } diff --git a/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs b/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs index 43573ade47..0832e33e90 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs @@ -17,8 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { @@ -26,9 +24,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Interface for TypeSystem objects that support interning. /// See for more information. /// - #if WITH_CONTRACTS - [ContractClass(typeof(ISupportsInterningContract))] - #endif public interface ISupportsInterning { /// @@ -46,25 +41,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// bool EqualsForInterning(ISupportsInterning other); } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(ISupportsInterning))] - abstract class ISupportsInterningContract : ISupportsInterning - { - void ISupportsInterning.PrepareForInterning(IInterningProvider provider) - { - Contract.Requires(provider != null); - } - - int ISupportsInterning.GetHashCodeForInterning() - { - return 0; - } - - bool ISupportsInterning.EqualsForInterning(ISupportsInterning other) - { - return false; - } - } - #endif } diff --git a/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs b/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs index efad8e983c..fc22826c37 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs @@ -17,8 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { @@ -26,9 +24,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Represents a reference to a type. /// Must be resolved before it can be used as type. /// - #if WITH_CONTRACTS - [ContractClass(typeof(ITypeReferenceContract))] - #endif public interface ITypeReference { // Keep this interface simple: I decided against having GetMethods/GetEvents etc. here, @@ -81,17 +76,4 @@ namespace ICSharpCode.NRefactory.TypeSystem ITypeResolveContext WithCurrentTypeDefinition(ITypeDefinition typeDefinition); ITypeResolveContext WithCurrentMember(IMember member); } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(ITypeReference))] - abstract class ITypeReferenceContract : ITypeReference - { - IType ITypeReference.Resolve(ITypeResolveContext context) - { - Contract.Requires(context != null); - Contract.Ensures(Contract.Result() != null); - return null; - } - } - #endif } \ No newline at end of file diff --git a/ICSharpCode.NRefactory/TypeSystem/IVariable.cs b/ICSharpCode.NRefactory/TypeSystem/IVariable.cs index e185247707..9e4d45835e 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IVariable.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IVariable.cs @@ -17,16 +17,12 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { /// /// Represents a variable (name/type pair). /// - #if WITH_CONTRACTS - [ContractClass(typeof(IVariableContract))] - #endif public interface IVariable { /// @@ -55,36 +51,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// object ConstantValue { get; } } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IVariable))] - abstract class IVariableContract : IVariable - { - string IVariable.Name { - get { - Contract.Ensures(Contract.Result() != null); - return null; - } - } - - ITypeReference IVariable.Type { - get { - Contract.Ensures(Contract.Result() != null); - return null; - } - } - - bool IVariable.IsConst { - get { - IVariable @this = this; - Contract.Ensures(Contract.Result() == (@this.ConstantValue != null)); - return false; - } - } - - object IVariable.ConstantValue { - get { return null; } - } - } - #endif }