예제 #1
0
    public virtual Differences VisitApplyToAll(ApplyToAll/*!*/ applyToAll1, ApplyToAll applyToAll2) {
      Differences differences = new Differences(applyToAll1, applyToAll2);
      if (applyToAll1 == null || applyToAll2 == null){
        if (applyToAll1 != applyToAll2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      ApplyToAll changes = (ApplyToAll)applyToAll2.Clone();
      ApplyToAll deletions = (ApplyToAll)applyToAll2.Clone();
      ApplyToAll insertions = (ApplyToAll)applyToAll2.Clone();

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

      diff = this.VisitExpression(applyToAll1.Operand2, applyToAll2.Operand2);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Operand2 = diff.Changes as Expression;
      deletions.Operand2 = diff.Deletions as Expression;
      insertions.Operand2 = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Operand2 && diff.Deletions == deletions.Operand2 && diff.Insertions == insertions.Operand2);
      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 Expression VisitApplyToAll(ApplyToAll applyToAll)
 {
     if (applyToAll == null) return null;
     return base.VisitApplyToAll((ApplyToAll)applyToAll.Clone());
 }