mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fail() call breaks control flow (PY-3886)
The original use case is TestCase.fail(), but other functions named fail() are probably also good candidates to break the control flow.
This commit is contained in:
@@ -68,7 +68,8 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
|
||||
public void visitPyCallExpression(final PyCallExpression node) {
|
||||
final PyExpression callee = node.getCallee();
|
||||
// Flow abrupted
|
||||
if (callee != null && "sys.exit".equals(PyUtil.getReadableRepr(callee, true))) {
|
||||
if (callee != null && ("sys.exit".equals(PyUtil.getReadableRepr(callee, true)) ||
|
||||
"fail".equals(callee.getName()))) {
|
||||
callee.accept(this);
|
||||
for (PyExpression expression : node.getArguments()) {
|
||||
expression.accept(this);
|
||||
|
||||
@@ -26,16 +26,19 @@
|
||||
<line>30</line>
|
||||
<description>This code is unreachable</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>unreachable.py</file>
|
||||
<line>36</line>
|
||||
<description>This code is unreachable</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>unreachable.py</file>
|
||||
<line>46</line>
|
||||
<description>This code is unreachable</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>unreachable.py</file>
|
||||
<line>69</line>
|
||||
<description>This code is unreachable</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
Reference in New Issue
Block a user