public virtual Differences VisitGotoCase(GotoCase gotoCase1, GotoCase gotoCase2){
      Differences differences = new Differences(gotoCase1, gotoCase2);
      if (gotoCase1 == null || gotoCase2 == null){
        if (gotoCase1 != gotoCase2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      GotoCase changes = (GotoCase)gotoCase2.Clone();
      GotoCase deletions = (GotoCase)gotoCase2.Clone();
      GotoCase insertions = (GotoCase)gotoCase2.Clone();

      Differences diff = this.VisitExpression(gotoCase1.CaseLabel, gotoCase2.CaseLabel);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.CaseLabel = diff.Changes as Identifier;
      deletions.CaseLabel = diff.Deletions as Identifier;
      insertions.CaseLabel = diff.Insertions as Identifier;
      Debug.Assert(diff.Changes == changes.CaseLabel && diff.Deletions == deletions.CaseLabel && diff.Insertions == insertions.CaseLabel);
      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;
    }
Exemple #2
0
 public override Statement VisitGotoCase(GotoCase gotoCase)
 {
     if (gotoCase == null) return null;
     return base.VisitGotoCase((GotoCase)gotoCase.Clone());
 }