Пример #1
0
 public RewriteAssertAssumeAndCallSiteRequires(Dictionary<Method, bool> replacementMethods, RuntimeContractMethods runtimeContracts, RuntimeContractEmitFlags emitFlags, Rewriter parent,
                               Method containingMethod)
 {
   this.methodTable = replacementMethods;
   this.runtimeContracts = runtimeContracts;
   this.emitFlags = emitFlags;
   this.parent = parent;
   this.containingMethod = containingMethod;
 }
Пример #2
0
 // Requires:
 //  replacementMethod.Keys == replacementExceptions.Keys
 //  
 public RewriteInvariant(RuntimeContractMethods rcm) {
   this.rcm = rcm;
 }
Пример #3
0
    /// <summary>
    /// For level, see TranslateLevel
    /// </summary>
    /// <param name="assemblyBeingRewritten"></param>
    /// <param name="rewriterNodes"></param>
    /// <param name="level"></param>
    public Rewriter(AssemblyNode assemblyBeingRewritten, RuntimeContractMethods runtimeContracts, Action<System.CodeDom.Compiler.CompilerError> handleError, bool inheritInvariantsAcrossAssemblies, bool skipQuantifiers)
    {
      Contract.Requires(handleError != null);

      // F:
      Contract.Requires(runtimeContracts != null);

      #region Find IDisposable.Dispose method
      TypeNode iDisposable = SystemTypes.IDisposable;
      if (iDisposable != null)
      {
        IDisposeMethod = iDisposable.GetMethod(Identifier.For("Dispose"));
      }
      #endregion

      this.runtimeContracts = runtimeContracts;
      this.assemblyBeingRewritten = assemblyBeingRewritten;
      this.rewriterNodes = runtimeContracts.ContractNodes;

      this.contractEmitFlags = TranslateLevel(this.runtimeContracts.RewriteLevel);

      this.contractEmitFlags |= RuntimeContractEmitFlags.InheritContracts; // default

      if (runtimeContracts.ThrowOnFailure)
      {
        this.contractEmitFlags |= RuntimeContractEmitFlags.ThrowOnFailure;
      }
      if (!runtimeContracts.UseExplicitValidation)
      {
        this.contractEmitFlags |= RuntimeContractEmitFlags.StandardMode;
      }
      this.m_handleError = handleError;
      this.InheritInvariantsAcrossAssemblies = inheritInvariantsAcrossAssemblies;
      this.skipQuantifiers = skipQuantifiers;
    }