public virtual Differences VisitTypeswitch(Typeswitch typeswitch1, Typeswitch typeswitch2){
      Differences differences = new Differences(typeswitch1, typeswitch2);
      if (typeswitch1 == null || typeswitch2 == null){
        if (typeswitch1 != typeswitch2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Typeswitch changes = (Typeswitch)typeswitch2.Clone();
      Typeswitch deletions = (Typeswitch)typeswitch2.Clone();
      Typeswitch insertions = (Typeswitch)typeswitch2.Clone();

      TypeswitchCaseList caseChanges, caseDeletions, caseInsertions;
      Differences diff = this.VisitTypeswitchCaseList(typeswitch1.Cases, typeswitch2.Cases, out caseChanges, out caseDeletions, out caseInsertions);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Cases = caseChanges;
      deletions.Cases = caseDeletions;
      insertions.Cases = caseInsertions;
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitExpression(typeswitch1.Expression, typeswitch2.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 VisitTypeswitch(Typeswitch Typeswitch)
 {
     if (Typeswitch == null) return null;
     return base.VisitTypeswitch((Typeswitch)Typeswitch.Clone());
 }