public virtual Differences VisitQueryAlias(QueryAlias alias1, QueryAlias alias2){
      Differences differences = new Differences(alias1, alias2);
      if (alias1 == null || alias2 == null){
        if (alias1 != alias2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      QueryAlias changes = (QueryAlias)alias2.Clone();
      QueryAlias deletions = (QueryAlias)alias2.Clone();
      QueryAlias insertions = (QueryAlias)alias2.Clone();

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

      diff = this.VisitIdentifier(alias1.Name, alias2.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;

      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 Node VisitQueryAlias(QueryAlias alias){
   if (alias == null) return null;
   return base.VisitQueryAlias((QueryAlias)alias.Clone());
 }