Microsoft.R.Core.AST.AstNode.GetElementsEnclosingRange C# (CSharp) Method

GetElementsEnclosingRange() public method

Finds two nodes that surround given text range
public GetElementsEnclosingRange ( int start, int length, IAstNode &startNode, PositionType &startPositionType, IAstNode &endNode, PositionType &endPositionType ) : IAstNode
start int Range start
length int Range length
startNode IAstNode Node that precedes the range or null if there is none
startPositionType PositionType Type of position in the start node
endNode IAstNode Node that follows the range or null if there is none
endPositionType PositionType Type of position in the end node
return IAstNode
        public IAstNode GetElementsEnclosingRange(
                                int start, int length,
                                out IAstNode startNode, out PositionType startPositionType,
                                out IAstNode endNode, out PositionType endPositionType) {
            int end = start + length;

            startPositionType = PositionType.Undefined;
            endPositionType = PositionType.Undefined;

            startNode = null;
            endNode = null;

            startPositionType = GetPositionNode(start, out startNode);
            endPositionType = GetPositionNode(end, out endNode);

            if (startNode == endNode)
                return startNode;

            return this;
        }