コード例 #1
0
    public virtual Differences VisitMemberBinding(MemberBinding memberBinding1, MemberBinding memberBinding2){
      Differences differences = new Differences(memberBinding1, memberBinding2);
      if (memberBinding1 == null || memberBinding2 == null){
        if (memberBinding1 != memberBinding2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      MemberBinding changes = (MemberBinding)memberBinding2.Clone();
      MemberBinding deletions = (MemberBinding)memberBinding2.Clone();
      MemberBinding insertions = (MemberBinding)memberBinding2.Clone();

      if (memberBinding1.Alignment == memberBinding2.Alignment) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;

      Differences diff = this.VisitMember(memberBinding1.BoundMember, memberBinding2.BoundMember);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.BoundMember = diff.Changes as Member;
      deletions.BoundMember = diff.Deletions as Member;
      insertions.BoundMember = diff.Insertions as Member;
      Debug.Assert(diff.Changes == changes.BoundMember && diff.Deletions == deletions.BoundMember && diff.Insertions == insertions.BoundMember);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitExpression(memberBinding1.TargetObject, memberBinding2.TargetObject);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.TargetObject = diff.Changes as Expression;
      deletions.TargetObject = diff.Deletions as Expression;
      insertions.TargetObject = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.TargetObject && diff.Deletions == deletions.TargetObject && diff.Insertions == insertions.TargetObject);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      if (memberBinding1.Volatile == memberBinding2.Volatile) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;

      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
ファイル: Duplicator.cs プロジェクト: hnlshzx/DotNetOpenAuth
 public override Expression VisitMemberBinding(MemberBinding memberBinding)
 {
     if (memberBinding == null) return null;
     memberBinding = (MemberBinding)memberBinding.Clone();
     memberBinding.TargetObject = this.VisitExpression(memberBinding.TargetObject);
     memberBinding.Type = this.VisitTypeReference(memberBinding.Type);
     memberBinding.BoundMember = this.VisitMemberReference(memberBinding.BoundMember);
     return memberBinding;
 }