A common supertype providing a shared implementation used by the classes LoopInvariant, Precondition, PostCondition, and TypeInvariant.
Inheritance: IContractElement
Example #1
0
            public override void RewriteChildren(ContractElement contractElement)
            {
                base.RewriteChildren(contractElement);
                var be = contractElement.Condition as IBlockExpression;

                if (be != null)
                {
                    var lb = new LocalBinder(this.host);
                    contractElement.Condition = lb.Rewrite(contractElement.Condition);
                    if (lb.localDeclarations.Any())
                    {
                        var be2 = new BlockExpression()
                        {
                            BlockStatement = new BlockStatement()
                            {
                                Statements = lb.localDeclarations,
                            },
                            Expression = contractElement.Condition,
                        };
                        contractElement.Condition = be2;
                    }
                }
            }
Example #2
0
    /// <summary>
    /// Called from the type specific copy method to copy the common part of all contract elments.
    /// </summary>
    /// <param name="contractElement"></param>
    private void Copy(ContractElement contractElement) {
      Contract.Requires(contractElement != null);

      contractElement.Condition = this.Copy(contractElement.Condition);
      if (contractElement.Description != null)
        contractElement.Description = this.Copy(contractElement.Description);
    }
Example #3
0
 public override void RewriteChildren(ContractElement contractElement) {
   base.RewriteChildren(contractElement);
   var be = contractElement.Condition as IBlockExpression;
   if (be != null) {
     var lb = new LocalBinder(this.host);
     contractElement.Condition = lb.Rewrite(contractElement.Condition);
     if (lb.localDeclarations.Any()) {
       var be2 = new BlockExpression() {
         BlockStatement = new BlockStatement() {
           Statements = lb.localDeclarations,
         },
         Expression = contractElement.Condition,
       };
       contractElement.Condition = be2;
     }
   }
 }