3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

remove dependencies on contracts

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-10-20 10:24:36 -07:00
parent 12fc670839
commit 3d37060fa9
72 changed files with 734 additions and 1232 deletions

View file

@ -17,8 +17,8 @@ Notes:
--*/
using System.Diagnostics;
using System;
using System.Diagnostics.Contracts;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
@ -29,7 +29,6 @@ namespace Microsoft.Z3
/// Internal base class for interfacing with native Z3 objects.
/// Should not be used externally.
/// </summary>
[ContractVerification(true)]
public class Z3Object : IDisposable
{
/// <summary>
@ -63,10 +62,9 @@ namespace Microsoft.Z3
#region Object Invariant
[ContractInvariantMethod]
private void ObjectInvariant()
{
Contract.Invariant(this.m_ctx != null);
Debug.Assert(this.m_ctx != null);
}
#endregion
@ -77,7 +75,7 @@ namespace Microsoft.Z3
internal Z3Object(Context ctx)
{
Contract.Requires(ctx != null);
Debug.Assert(ctx != null);
Interlocked.Increment(ref ctx.refCount);
m_ctx = ctx;
@ -85,7 +83,7 @@ namespace Microsoft.Z3
internal Z3Object(Context ctx, IntPtr obj)
{
Contract.Requires(ctx != null);
Debug.Assert(ctx != null);
Interlocked.Increment(ref ctx.refCount);
m_ctx = ctx;
@ -119,16 +117,12 @@ namespace Microsoft.Z3
{
get
{
Contract.Ensures(Contract.Result<Context>() != null);
return m_ctx;
}
}
[Pure]
internal static IntPtr[] ArrayToNative(Z3Object[] a)
{
Contract.Ensures(a == null || Contract.Result<IntPtr[]>() != null);
Contract.Ensures(a == null || Contract.Result<IntPtr[]>().Length == a.Length);
if (a == null) return null;
IntPtr[] an = new IntPtr[a.Length];
@ -137,11 +131,8 @@ namespace Microsoft.Z3
return an;
}
[Pure]
internal static IntPtr[] EnumToNative<T>(IEnumerable<T> a) where T : Z3Object
{
Contract.Ensures(a == null || Contract.Result<IntPtr[]>() != null);
Contract.Ensures(a == null || Contract.Result<IntPtr[]>().Length == a.Count());
if (a == null) return null;
IntPtr[] an = new IntPtr[a.Count()];
@ -154,7 +145,6 @@ namespace Microsoft.Z3
return an;
}
[Pure]
internal static uint ArrayLength(Z3Object[] a)
{
return (a == null)?0:(uint)a.Length;