public void AppendChild(IAstNode child) {
if (child.Parent == null) {
child.Parent = this;
} else if (child.Parent == this) {
#if DEBUG
//foreach (var c in _children)
//{
// Debug.Assert(!TextRange.Intersect(c, child), "Children collection already contains overlapping node");
//}
#endif
_children.AddSorted(child);
} else {
throw new InvalidOperationException("Node already has parent");
}
}