forked from VimPlug/jedi
Move in_which_test_node -> get_corresponding_test_node.
This commit is contained in:
@@ -84,7 +84,7 @@ def _break_check(context, context_scope, flow_scope, node):
|
|||||||
break
|
break
|
||||||
reachable = reachable.invert()
|
reachable = reachable.invert()
|
||||||
else:
|
else:
|
||||||
flow_node = flow_scope.in_which_test_node(node)
|
flow_node = flow_scope.get_corresponding_test_node(node)
|
||||||
if flow_node is not None:
|
if flow_node is not None:
|
||||||
reachable = _check_if(context, flow_node)
|
reachable = _check_if(context, flow_node)
|
||||||
elif flow_scope.type in ('try_stmt', 'while_stmt'):
|
elif flow_scope.type in ('try_stmt', 'while_stmt'):
|
||||||
|
|||||||
@@ -693,11 +693,11 @@ class IfStmt(Flow):
|
|||||||
if c in ('elif', 'if'):
|
if c in ('elif', 'if'):
|
||||||
yield self.children[i + 1]
|
yield self.children[i + 1]
|
||||||
|
|
||||||
def in_which_test_node(self, node):
|
def get_corresponding_test_node(self, node):
|
||||||
"""
|
"""
|
||||||
Returns the test node (see function above) that a node is contained
|
Searches for the branch in which the node is and returns the
|
||||||
in. However if the node is in the test node itself and not in the
|
corresponding test node (see function above). However if the node is in
|
||||||
suite return None.
|
the test node itself and not in the suite return None.
|
||||||
"""
|
"""
|
||||||
start_pos = node.start_pos
|
start_pos = node.start_pos
|
||||||
for check_node in reversed(list(self.get_test_nodes())):
|
for check_node in reversed(list(self.get_test_nodes())):
|
||||||
|
|||||||
Reference in New Issue
Block a user