Ejemplo n.º 1
0
    public virtual Differences VisitYield(Yield yield1, Yield yield2){
      Differences differences = new Differences(yield1, yield2);
      if (yield1 == null || yield2 == null){
        if (yield1 != yield2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Yield changes = (Yield)yield2.Clone();
      Yield deletions = (Yield)yield2.Clone();
      Yield insertions = (Yield)yield2.Clone();

      Differences diff = this.VisitExpression(yield1.Expression, yield2.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;
    }
Ejemplo n.º 2
0
 public override Statement VisitYield(Yield Yield)
 {
     if (Yield == null) return null;
     return base.VisitYield((Yield)Yield.Clone());
 }