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
newNode.SetRole(this.Role); newNode.SetRole(this.Role);
newNode.prevSibling = prevSibling; newNode.prevSibling = prevSibling;
newNode.nextSibling = nextSibling; newNode.nextSibling = nextSibling;
if (parent != null) {
if (prevSibling != null) { if (prevSibling != null) {
Debug.Assert (prevSibling.nextSibling == this); Debug.Assert (prevSibling.nextSibling == this);
prevSibling.nextSibling = newNode; prevSibling.nextSibling = newNode;
} else { } else {
Debug.Assert (parent.firstChild == this); Debug.Assert (parent.firstChild == this);
parent.firstChild = newNode; parent.firstChild = newNode;
} }
if (nextSibling != null) { if (nextSibling != null) {
Debug.Assert (nextSibling.prevSibling == this); Debug.Assert (nextSibling.prevSibling == this);
nextSibling.prevSibling = newNode; nextSibling.prevSibling = newNode;
} else { } else {
Debug.Assert (parent.lastChild == this); Debug.Assert (parent.lastChild == this);
parent.lastChild = newNode; parent.lastChild = newNode;
}
parent = null;
prevSibling = null;
nextSibling = null;
} }
parent = null;
prevSibling = null;
nextSibling = null;
} }
public AstNode ReplaceWith (Func<AstNode, AstNode> replaceFunction) public AstNode ReplaceWith (Func<AstNode, AstNode> replaceFunction)

Loading…
Cancel
Save