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
コード例 #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);
 }
コード例 #2
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <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;
 }
コード例 #3
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <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);
 }
コード例 #4
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <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);
 }
コード例 #5
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <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);
 }
コード例 #6
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <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;
 }