public virtual Differences VisitConstrainedType(ConstrainedType cType1, ConstrainedType cType2){ Differences differences = new Differences(cType1, cType2); if (cType1 == null || cType2 == null){ if (cType1 != cType2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } ConstrainedType changes = (ConstrainedType)cType2.Clone(); ConstrainedType deletions = (ConstrainedType)cType2.Clone(); ConstrainedType insertions = (ConstrainedType)cType2.Clone(); Differences diff = this.VisitExpression(cType1.Constraint, cType2.Constraint); if (diff == null){Debug.Assert(false); return differences;} changes.Constraint = diff.Changes as Expression; deletions.Constraint = diff.Deletions as Expression; insertions.Constraint = diff.Insertions as Expression; Debug.Assert(diff.Changes == changes.Constraint && diff.Deletions == deletions.Constraint && diff.Insertions == insertions.Constraint); differences.NumberOfDifferences += diff.NumberOfDifferences; differences.NumberOfSimilarities += diff.NumberOfSimilarities; diff = this.VisitTypeNode(cType1.UnderlyingType, cType2.UnderlyingType); if (diff == null){Debug.Assert(false); return differences;} changes.UnderlyingType = diff.Changes as TypeNode; deletions.UnderlyingType = diff.Deletions as TypeNode; insertions.UnderlyingType = diff.Insertions as TypeNode; //Debug.Assert(diff.Changes == changes.UnderlyingType && diff.Deletions == deletions.UnderlyingType && diff.Insertions == insertions.UnderlyingType); 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 TypeNode VisitConstrainedType(ConstrainedType cType){ if (cType == null) return null; return base.VisitConstrainedType((ConstrainedType)cType.Clone()); }