public virtual Differences VisitTypeswitchCase(TypeswitchCase typeswitchCase1, TypeswitchCase typeswitchCase2){ Differences differences = new Differences(typeswitchCase1, typeswitchCase2); if (typeswitchCase1 == null || typeswitchCase2 == null){ if (typeswitchCase1 != typeswitchCase2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } TypeswitchCase changes = (TypeswitchCase)typeswitchCase2.Clone(); TypeswitchCase deletions = (TypeswitchCase)typeswitchCase2.Clone(); TypeswitchCase insertions = (TypeswitchCase)typeswitchCase2.Clone(); Differences diff = this.VisitBlock(typeswitchCase1.Body, typeswitchCase2.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.VisitTypeNode(typeswitchCase1.LabelType, typeswitchCase2.LabelType); if (diff == null){Debug.Assert(false); return differences;} changes.LabelType = diff.Changes as TypeNode; deletions.LabelType = diff.Deletions as TypeNode; insertions.LabelType = diff.Insertions as TypeNode; //Debug.Assert(diff.Changes == changes.LabelType && diff.Deletions == deletions.LabelType && diff.Insertions == insertions.LabelType); differences.NumberOfDifferences += diff.NumberOfDifferences; differences.NumberOfSimilarities += diff.NumberOfSimilarities; diff = this.VisitExpression(typeswitchCase1.LabelVariable, typeswitchCase2.LabelVariable); if (diff == null){Debug.Assert(false); return differences;} changes.LabelVariable = diff.Changes as Expression; deletions.LabelVariable = diff.Deletions as Expression; insertions.LabelVariable = diff.Insertions as Expression; Debug.Assert(diff.Changes == changes.LabelVariable && diff.Deletions == deletions.LabelVariable && diff.Insertions == insertions.LabelVariable); 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; }
public override TypeswitchCase VisitTypeswitchCase(TypeswitchCase typeswitchCase) { if (typeswitchCase == null) return null; return base.VisitTypeswitchCase((TypeswitchCase)typeswitchCase.Clone()); }