public virtual Differences VisitExpressionSnippet(ExpressionSnippet snippet1, ExpressionSnippet snippet2){ Differences differences = new Differences(snippet1, snippet2); if (snippet1 == null || snippet2 == null){ if (snippet1 != snippet2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } ExpressionSnippet changes = (ExpressionSnippet)snippet2.Clone(); ExpressionSnippet deletions = (ExpressionSnippet)snippet2.Clone(); ExpressionSnippet insertions = (ExpressionSnippet)snippet2.Clone(); if (snippet1.SourceContext.Document == null || snippet2.SourceContext.Document == null){ if (snippet1.SourceContext.Document == snippet2.SourceContext.Document) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++; }else if (snippet1.SourceContext.Document.Name == snippet2.SourceContext.Document.Name) 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; }
public override Expression VisitExpressionSnippet(ExpressionSnippet snippet) { if (snippet == null) return null; return base.VisitExpressionSnippet((ExpressionSnippet)snippet.Clone()); }