public virtual Differences VisitNameBinding(NameBinding nameBinding1, NameBinding nameBinding2){
      Differences differences = new Differences(nameBinding1, nameBinding2);
      if (nameBinding1 == null || nameBinding2 == null){
        if (nameBinding1 != nameBinding2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      NameBinding changes = (NameBinding)nameBinding2.Clone();
      NameBinding deletions = (NameBinding)nameBinding2.Clone();
      NameBinding insertions = (NameBinding)nameBinding2.Clone();

      MemberList memChanges, memDeletions, memInsertions;
      Differences diff = this.VisitMemberList(nameBinding1.BoundMembers, nameBinding2.BoundMembers, out memChanges, out memDeletions, out memInsertions);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.BoundMembers = memChanges;
      deletions.BoundMembers = memDeletions;
      insertions.BoundMembers = memInsertions;
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitIdentifier(nameBinding1.Identifier, nameBinding2.Identifier);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Identifier = diff.Changes as Identifier;
      deletions.Identifier = diff.Deletions as Identifier;
      insertions.Identifier = diff.Insertions as Identifier;
      Debug.Assert(diff.Changes == changes.Identifier && diff.Deletions == deletions.Identifier && diff.Insertions == insertions.Identifier);
      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;
    }
Beispiel #2
0
 public override Expression VisitNameBinding(NameBinding nameBinding)
 {
     if (nameBinding == null) return null;
     nameBinding = (NameBinding)nameBinding.Clone();
     nameBinding.BoundMember = this.VisitExpression(nameBinding.BoundMember);
     nameBinding.BoundMembers = this.VisitMemberReferenceList(nameBinding.BoundMembers);
     return nameBinding;
 }