A statement that asserts that a condition will always be true when execution reaches it. For example the assume statement of Spec# or a call to System.Diagnostics.Assert in C#.
Inheritance: Statement, IAssumeStatement
Esempio n. 1
0
 /// <summary>
 /// Visits the specified block.
 /// </summary>
 /// <param name="block">The block.</param>
 public override void Visit(IBlockStatement block)
 {
     if (this.insertAssumeFalseAtLine != null) {
     uint startLine;
     uint endLine;
     GetLocationLineSpan(GetPrimarySourceLocationFrom(block.Locations), out startLine, out endLine);
     if (startLine <= this.insertAssumeFalseAtLine.Value &&
        this.insertAssumeFalseAtLine.Value < endLine) {
       foreach (IStatement stmt in block.Statements) {
     GetLocationLineSpan(GetPrimarySourceLocationFrom(stmt.Locations), out startLine, out endLine);
     GetPrimarySourceLocationFrom(stmt.Locations);
     if (this.insertAssumeFalseAtLine.Value < endLine) {
       AssumeStatement assumeFalse = new AssumeStatement();
       CompileTimeConstant constFalse = new CompileTimeConstant();
       constFalse.Value = false;
       assumeFalse.Condition = constFalse;
       this.GetOrCreateStmtListForStmt(stmt).Add(assumeFalse);
       break;
     }
       }
     }
       }
       base.Visit(block);
 }
Esempio n. 2
0
 /// <summary>
 /// Visits the specified assume statement.
 /// </summary>
 /// <param name="assumeStatement">The assume statement.</param>
 /// <returns></returns>
 protected virtual IStatement DeepCopy(AssumeStatement assumeStatement)
 {
     assumeStatement.Condition = this.Substitute(assumeStatement.Condition);
       return assumeStatement;
 }
Esempio n. 3
0
 /// <summary>
 /// Visits the specified assume statement.
 /// </summary>
 /// <param name="assumeStatement">The assume statement.</param>
 public override void Visit(IAssumeStatement assumeStatement)
 {
     AssumeStatement mutableAssumeStatement = new AssumeStatement(assumeStatement);
     this.resultStatement = this.myCodeCopier.DeepCopy(mutableAssumeStatement);
 }
Esempio n. 4
0
 /// <summary>
 /// Rewrites the children of the given assume statement.
 /// </summary>
 /// <param name="assumeStatement"></param>
 public virtual void RewriteChildren(AssumeStatement assumeStatement)
 {
     this.RewriteChildren((Statement)assumeStatement);
       assumeStatement.Condition = this.Rewrite(assumeStatement.Condition);
       if (assumeStatement.Description != null)
     assumeStatement.Description = this.Rewrite(assumeStatement.Description);
 }
Esempio n. 5
0
 /// <summary>
 /// Visits the specified assume statement.
 /// </summary>
 /// <param name="assumeStatement">The assume statement.</param>
 public override void Visit(IAssumeStatement assumeStatement)
 {
     AssumeStatement mutableAssumeStatement = assumeStatement as AssumeStatement;
     if (alwaysMakeACopy || mutableAssumeStatement == null) mutableAssumeStatement = new AssumeStatement(assumeStatement);
     this.resultStatement = this.myCodeMutator.Visit(mutableAssumeStatement);
 }
Esempio n. 6
0
 /// <summary>
 /// Visits the specified assume statement.
 /// </summary>
 /// <param name="assumeStatement">The assume statement.</param>
 /// <returns></returns>
 public virtual IStatement Visit(AssumeStatement assumeStatement)
 {
     assumeStatement.Condition = this.Visit(assumeStatement.Condition);
       return assumeStatement;
 }