public virtual Differences VisitSwitchInstruction(SwitchInstruction switchInstruction1, SwitchInstruction switchInstruction2){ Differences differences = new Differences(switchInstruction1, switchInstruction2); if (switchInstruction1 == null || switchInstruction2 == null){ if (switchInstruction1 != switchInstruction2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } SwitchInstruction changes = (SwitchInstruction)switchInstruction2.Clone(); SwitchInstruction deletions = (SwitchInstruction)switchInstruction2.Clone(); SwitchInstruction insertions = (SwitchInstruction)switchInstruction2.Clone(); Differences diff = this.VisitExpression(switchInstruction1.Expression, switchInstruction2.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; BlockList blockChanges, blockDeletions, blockInsertions; diff = this.VisitBlockList(switchInstruction1.Targets, switchInstruction2.Targets, out blockChanges, out blockDeletions, out blockInsertions); if (diff == null){Debug.Assert(false); return differences;} changes.Targets = blockChanges; deletions.Targets = blockDeletions; insertions.Targets = blockInsertions; 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; }
public override Statement VisitSwitchInstruction(SwitchInstruction switchInstruction) { if (switchInstruction == null) return null; switchInstruction = (SwitchInstruction)base.VisitSwitchInstruction((SwitchInstruction)switchInstruction.Clone()); if (switchInstruction == null) return null; switchInstruction.Targets = this.VisitBlockList(switchInstruction.Targets); return switchInstruction; }