From 24f16370936084c2b6aa8ced3c8af0d8ffa0d0b7 Mon Sep 17 00:00:00 2001 From: turbanoff Date: Fri, 20 Apr 2012 15:23:41 +0700 Subject: [PATCH] remove redundant check --- ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs | 35 ++++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index bc4d27de03..3f9f86bb78 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -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 replaceFunction)