public virtual Differences VisitTypeModifier(TypeModifier typeModifier1, TypeModifier typeModifier2){ Differences differences = new Differences(typeModifier1, typeModifier2); if (typeModifier1 == null || typeModifier2 == null){ if (typeModifier1 != typeModifier2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } TypeModifier changes = (TypeModifier)typeModifier2.Clone(); TypeModifier deletions = (TypeModifier)typeModifier2.Clone(); TypeModifier insertions = (TypeModifier)typeModifier2.Clone(); Differences diff = this.VisitTypeNode(typeModifier1.ModifiedType, typeModifier2.ModifiedType); if (diff == null){Debug.Assert(false); return differences;} changes.ModifiedType = diff.Changes as TypeNode; deletions.ModifiedType = diff.Deletions as TypeNode; insertions.ModifiedType = diff.Insertions as TypeNode; //Debug.Assert(diff.Changes == changes.ModifiedType && diff.Deletions == deletions.ModifiedType && diff.Insertions == insertions.ModifiedType); differences.NumberOfDifferences += diff.NumberOfDifferences; differences.NumberOfSimilarities += diff.NumberOfSimilarities; diff = this.VisitTypeNode(typeModifier1.Modifier, typeModifier2.Modifier); if (diff == null){Debug.Assert(false); return differences;} changes.Modifier = diff.Changes as TypeNode; deletions.Modifier = diff.Deletions as TypeNode; insertions.Modifier = diff.Insertions as TypeNode; //Debug.Assert(diff.Changes == changes.Modifier && diff.Deletions == deletions.Modifier && diff.Insertions == insertions.Modifier); 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 TypeModifier VisitTypeModifier(TypeModifier typeModifier) { if (typeModifier == null) return null; return base.VisitTypeModifier((TypeModifier)typeModifier.Clone()); }