コード例 #1
0
    public virtual Differences VisitFixed(Fixed fixed1, Fixed fixed2){
      Differences differences = new Differences(fixed1, fixed2);
      if (fixed1 == null || fixed2 == null){
        if (fixed1 != fixed2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Fixed changes = (Fixed)fixed2.Clone();
      Fixed deletions = (Fixed)fixed2.Clone();
      Fixed insertions = (Fixed)fixed2.Clone();

      Differences diff = this.VisitBlock(fixed1.Body, fixed2.Body);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Body = diff.Changes as Block;
      deletions.Body = diff.Deletions as Block;
      insertions.Body = diff.Insertions as Block;
      Debug.Assert(diff.Changes == changes.Body && diff.Deletions == deletions.Body && diff.Insertions == insertions.Body);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitStatement(fixed1.Declarators, fixed2.Declarators);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Declarators = diff.Changes as Statement;
      deletions.Declarators = diff.Deletions as Statement;
      insertions.Declarators = diff.Insertions as Statement;
      Debug.Assert(diff.Changes == changes.Declarators && diff.Deletions == deletions.Declarators && diff.Insertions == insertions.Declarators);
      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
ファイル: Duplicator.cs プロジェクト: hnlshzx/DotNetOpenAuth
 public override Statement VisitFixed(Fixed Fixed)
 {
     if (Fixed == null) return null;
     return base.VisitFixed((Fixed)Fixed.Clone());
 }