fixed PY-3121 "Statement has no effect" inspection should not react on statements that contain error elements

This commit is contained in:
Ekaterina Tuzova
2011-03-23 17:56:05 +03:00
parent 563b6f9aa3
commit 62c3cf2dfa
@@ -50,6 +50,8 @@ public class PyStatementEffectInspection extends PyInspection {
return;
}
final PyExpression expression = node.getExpression();
if (PsiTreeUtil.hasErrorElements(expression))
return;
if (hasEffect(expression)) return;
final PyTryPart tryPart = PsiTreeUtil.getParentOfType(node, PyTryPart.class);
@@ -62,7 +64,8 @@ public class PyStatementEffectInspection extends PyInspection {
return;
}
}
registerProblem(expression, "Statement seems to have no effect", new StatementEffectIntroduceVariableQuickFix(expression));
registerProblem(expression, "Statement seems to have no effect",
new StatementEffectIntroduceVariableQuickFix(expression));
}
private boolean hasEffect(@Nullable PyExpression expression) {