one more case of dedenting after control flow break (PY-289)

This commit is contained in:
Dmitry Jemerov
2010-09-03 22:48:10 +04:00
parent 7ec08170a5
commit c3ba4d0992
2 changed files with 16 additions and 0 deletions
@@ -385,6 +385,9 @@ public class PyBlock implements ASTBlock {
while (lastChild != null) {
IElementType last_type = lastChild.getElementType();
if ( last_type == PyElementTypes.STATEMENT_LIST && hasLineBreakBefore(lastChild)) {
if (dedentAfterLastStatement((PyStatementList)lastChild.getPsi())) {
break;
}
statementListsBelow++;
}
else if (statementListsBelow > 0 && lastChild.getPsi() instanceof PsiErrorElement) {
@@ -167,6 +167,19 @@ public class PyIndentTest extends PyLightFixtureTestCase {
" <caret>");
}
public void testUnindentAfterReturnNotLast() { // PY-289
doTest("def foo():\n" +
" if True:\n" +
" return<caret>\n" +
"def bar(): pass",
"def foo():\n" +
" if True:\n" +
" return\n" +
" <caret>\n" +
"def bar(): pass"
);
}
/*
TODO: formatter core problem?
public void testAlignListBeforeEquals() throws Exception {