/// <summary> /// Gets the node that fully contains the range from startLocation to endLocation. /// </summary> public AstNode GetNodeContaining(TextLocation startLocation, TextLocation endLocation) { for (AstNode child = firstChild; child != null; child = child.nextSibling) { if (child.StartLocation <= startLocation && endLocation <= child.EndLocation) { return(child.GetNodeContaining(startLocation, endLocation)); } } return(this); }