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

      Differences diff = this.VisitTypeNode(consArr1.ElementType, consArr2.ElementType);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.ElementType = diff.Changes as TypeNode;
      deletions.ElementType = diff.Deletions as TypeNode;
      insertions.ElementType = diff.Insertions as TypeNode;
      //Debug.Assert(diff.Changes == changes.ElementType && diff.Deletions == deletions.ElementType && diff.Insertions == insertions.ElementType);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      ExpressionList exprChanges, exprDeletions, exprInsertions;
      diff = this.VisitExpressionList(consArr1.Initializers, consArr2.Initializers, out exprChanges, out exprDeletions, out exprInsertions);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Operands = exprChanges;
      deletions.Operands = exprDeletions;
      insertions.Operands = exprInsertions;
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitExpressionList(consArr1.Operands, consArr2.Operands, out exprChanges, out exprDeletions, out exprInsertions);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Operands = exprChanges;
      deletions.Operands = exprDeletions;
      insertions.Operands = exprInsertions;
      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;
    }
コード例 #2
0
ファイル: Duplicator.cs プロジェクト: hnlshzx/DotNetOpenAuth
 public override Expression VisitConstructFlexArray(ConstructFlexArray consArr)
 {
     if (consArr == null) return null;
     return base.VisitConstructFlexArray((ConstructFlexArray)consArr.Clone());
 }