A common supertype providing a shared implementation used by the classes LoopInvariant, Precondition, PostCondition, and TypeInvariant.
Наследование: IContractElement
Пример #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;
                    }
                }
            }
Пример #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);
    }
Пример #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;
     }
   }
 }