public virtual Differences VisitNamedArgument(NamedArgument namedArgument1, NamedArgument namedArgument2){
      Differences differences = new Differences(namedArgument1, namedArgument2);
      if (namedArgument1 == null || namedArgument2 == null){
        if (namedArgument1 != namedArgument2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      NamedArgument changes = (NamedArgument)namedArgument2.Clone();
      NamedArgument deletions = (NamedArgument)namedArgument2.Clone();
      NamedArgument insertions = (NamedArgument)namedArgument2.Clone();

      if (namedArgument1.IsCustomAttributeProperty == namedArgument2.IsCustomAttributeProperty) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;

      Differences diff = this.VisitIdentifier(namedArgument1.Name, namedArgument2.Name);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Name = diff.Changes as Identifier;
      deletions.Name = diff.Deletions as Identifier;
      insertions.Name = diff.Insertions as Identifier;
      Debug.Assert(diff.Changes == changes.Name && diff.Deletions == deletions.Name && diff.Insertions == insertions.Name);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitExpression(namedArgument1.Value, namedArgument2.Value);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Value = diff.Changes as Expression;
      deletions.Value = diff.Deletions as Expression;
      insertions.Value = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Value && diff.Deletions == deletions.Value && diff.Insertions == insertions.Value);
      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;
    }
Example #2
0
 public override Expression VisitNamedArgument(NamedArgument namedArgument)
 {
     if (namedArgument == null) return null;
     return base.VisitNamedArgument((NamedArgument)namedArgument.Clone());
 }