mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup
This commit is contained in:
@@ -19,14 +19,13 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.python.psi.*;
|
||||
|
||||
/**
|
||||
* Highlights incorrect return statements: 'return' and 'yield' outside functions, returning values from generators;
|
||||
* Highlights incorrect return statements: 'return' and 'yield' outside functions, returning values from generators.
|
||||
*/
|
||||
public class ReturnAnnotator extends PyAnnotator {
|
||||
public void visitPyReturnStatement(final PyReturnStatement node) {
|
||||
PyFunction function = PsiTreeUtil.getParentOfType(node, PyFunction.class, false, PyClass.class);
|
||||
if (function == null) {
|
||||
getHolder().createErrorAnnotation(node, "'return' outside of function");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +33,5 @@ public class ReturnAnnotator extends PyAnnotator {
|
||||
if (PsiTreeUtil.getParentOfType(node, PyFunction.class, false, PyClass.class) == null) {
|
||||
getHolder().createErrorAnnotation(node, "'yield' outside of function");
|
||||
}
|
||||
/* this is now allowed in python 2.5
|
||||
if (node.getContainingElement(PyTryFinallyStatement.class) != null) {
|
||||
getHolder().createErrorAnnotation(node, "'yield' not allowed in a 'try' block with a 'finally' clause");
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user