Browse Source

Merge pull request #43 from turbanoff/patch-1

remove redundant check
newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
0179c76aa2
  1. 35
      ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

35
ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

@ -483,25 +483,24 @@ namespace ICSharpCode.NRefactory.CSharp @@ -483,25 +483,24 @@ namespace ICSharpCode.NRefactory.CSharp
newNode.SetRole(this.Role);
newNode.prevSibling = prevSibling;
newNode.nextSibling = nextSibling;
if (parent != null) {
if (prevSibling != null) {
Debug.Assert (prevSibling.nextSibling == this);
prevSibling.nextSibling = newNode;
} else {
Debug.Assert (parent.firstChild == this);
parent.firstChild = newNode;
}
if (nextSibling != null) {
Debug.Assert (nextSibling.prevSibling == this);
nextSibling.prevSibling = newNode;
} else {
Debug.Assert (parent.lastChild == this);
parent.lastChild = newNode;
}
parent = null;
prevSibling = null;
nextSibling = null;
if (prevSibling != null) {
Debug.Assert (prevSibling.nextSibling == this);
prevSibling.nextSibling = newNode;
} else {
Debug.Assert (parent.firstChild == this);
parent.firstChild = newNode;
}
if (nextSibling != null) {
Debug.Assert (nextSibling.prevSibling == this);
nextSibling.prevSibling = newNode;
} else {
Debug.Assert (parent.lastChild == this);
parent.lastChild = newNode;
}
parent = null;
prevSibling = null;
nextSibling = null;
}
public AstNode ReplaceWith (Func<AstNode, AstNode> replaceFunction)

Loading…
Cancel
Save