示例#1
0
        public static bool TryCreate(BlockSyntax block, TextSpan span, out StatementContainerSelection selectedStatements)
        {
            StatementContainer container;

            if (StatementContainer.TryCreate(block, out container))
            {
                return(TryCreate(container, span, out selectedStatements));
            }
            else
            {
                selectedStatements = null;
                return(false);
            }
        }
示例#2
0
        public static bool TryCreate(StatementContainer container, TextSpan span, out StatementContainerSelection selectedStatements)
        {
            if (container.Statements.Any())
            {
                IndexPair indexes = GetIndexes(container.Statements, span);

                if (indexes.StartIndex != -1)
                {
                    selectedStatements = new StatementContainerSelection(container, span, indexes.StartIndex, indexes.EndIndex);
                    return(true);
                }
            }

            selectedStatements = null;
            return(false);
        }
        public static bool TryCreate(StatementContainer container, TextSpan span, out StatementContainerSelection selection)
        {
            selection = null;

            SyntaxList <StatementSyntax> statements = container.Statements;

            if (!statements.Any())
            {
                return(false);
            }

            (int startIndex, int endIndex) = GetIndexes(statements, span);

            if (startIndex == -1)
            {
                return(false);
            }

            selection = new StatementContainerSelection(container, span, startIndex, endIndex);
            return(true);
        }