mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-5193 Move Statement: do not allow to move break and continue statements out of a loop
This commit is contained in:
+2
-1
@@ -59,7 +59,8 @@ public class StatementMover extends LineMover {
|
||||
// check if we want to move statement
|
||||
if (myStatementToMove == null) return false;
|
||||
//do not move pass statement
|
||||
if (myStatementToMove instanceof PyPassStatement) {
|
||||
if (myStatementToMove instanceof PyPassStatement || myStatementToMove instanceof PyBreakStatement
|
||||
|| myStatementToMove instanceof PyContinueStatement) {
|
||||
info.toMove2 = info.toMove;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
test()
|
||||
for item in range(10):
|
||||
co<caret>ntinue
|
||||
test1()
|
||||
@@ -0,0 +1,4 @@
|
||||
test()
|
||||
for item in range(10):
|
||||
continue
|
||||
test1()
|
||||
@@ -0,0 +1,4 @@
|
||||
test()
|
||||
for item in range(10):
|
||||
continue
|
||||
test1()
|
||||
@@ -92,7 +92,11 @@ public class PyStatementMoverTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFunctionDown() {
|
||||
public void testFunctionDown() { // PY-5195
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testContinueBreak() { // PY-5193
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user