Exemplo n.º 1
0
        private static bool CanRefactor(RefactoringContext context, BlockSyntax block)
        {
            if (context.Span.IsEmptyAndContainedInSpanOrBetweenSpans(block) &&
                EmbeddedStatement.IsEmbeddableBlock(block))
            {
                StatementSyntax statement = EmbeddedStatement.GetEmbeddedStatement(block.Statements[0]);

                return(statement == null ||
                       !statement.FullSpan.Contains(context.Span));
            }

            return(false);
        }
Exemplo n.º 2
0
        private static bool CanRefactorIfElse(BlockSyntax selectedBlock, IfStatementSyntax topmostIf)
        {
            bool success = false;

            foreach (BlockSyntax block in GetBlocks(topmostIf))
            {
                if (block == selectedBlock)
                {
                    continue;
                }
                else if (EmbeddedStatement.IsEmbeddableBlock(block))
                {
                    success = true;
                }
                else
                {
                    return(false);
                }
            }

            return(success);
        }