Ejemplo n.º 1
0
    public virtual Differences VisitPrefixExpression(PrefixExpression pExpr1, PrefixExpression pExpr2){
      Differences differences = new Differences(pExpr1, pExpr2);
      if (pExpr1 == null || pExpr2 == null){
        if (pExpr1 != pExpr2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      PrefixExpression changes = (PrefixExpression)pExpr2.Clone();
      PrefixExpression deletions = (PrefixExpression)pExpr2.Clone();
      PrefixExpression insertions = (PrefixExpression)pExpr2.Clone();

      Differences diff = this.VisitExpression(pExpr1.Expression, pExpr2.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;

      if (pExpr1.Operator == pExpr2.Operator) 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;
    }
Ejemplo n.º 2
0
 public override Expression VisitPrefixExpression(PrefixExpression pExpr)
 {
     if (pExpr == null) return null;
     return base.VisitPrefixExpression((PrefixExpression)pExpr.Clone());
 }