예제 #1
0
    public virtual Differences VisitExpressionStatement(ExpressionStatement statement1, ExpressionStatement statement2){
      Differences differences = new Differences(statement1, statement2);
      if (statement1 == null || statement2 == null){
        if (statement1 != statement2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      ExpressionStatement changes = (ExpressionStatement)statement2.Clone();
      ExpressionStatement deletions = (ExpressionStatement)statement2.Clone();
      ExpressionStatement insertions = (ExpressionStatement)statement2.Clone();

      Differences diff = this.VisitExpression(statement1.Expression, statement2.Expression);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Expression = diff.Changes as Expression;
      deletions.Expression = diff.Deletions as Expression;
      insertions.Expression = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Expression && diff.Deletions == deletions.Expression && diff.Insertions == insertions.Expression);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
예제 #2
0
 public override Statement VisitExpressionStatement(ExpressionStatement statement)
 {
     if (statement == null) return null;
     return base.VisitExpressionStatement((ExpressionStatement)statement.Clone());
 }