diff --git a/jedi/evaluate/flow_analysis.py b/jedi/evaluate/flow_analysis.py index 3f08bf5e..3a0c03d5 100644 --- a/jedi/evaluate/flow_analysis.py +++ b/jedi/evaluate/flow_analysis.py @@ -78,13 +78,13 @@ def _break_check(context, context_scope, flow_scope, node): reachable = REACHABLE if flow_scope.type == 'if_stmt': if flow_scope.is_node_after_else(node): - for check_node in flow_scope.get_check_nodes(): + for check_node in flow_scope.get_test_nodes(): reachable = _check_if(context, check_node) if reachable in (REACHABLE, UNSURE): break reachable = reachable.invert() else: - flow_node = flow_scope.node_in_which_check_node(node) + flow_node = flow_scope.in_which_test_node(node) if flow_node is not None: reachable = _check_if(context, flow_node) elif flow_scope.type in ('try_stmt', 'while_stmt'): diff --git a/jedi/parser/python/tree.py b/jedi/parser/python/tree.py index e84c596e..139c0e85 100644 --- a/jedi/parser/python/tree.py +++ b/jedi/parser/python/tree.py @@ -678,9 +678,9 @@ class IfStmt(Flow): type = 'if_stmt' __slots__ = () - def get_check_nodes(self): + def get_test_nodes(self): """ - Returns all the `test` nodes that are defined as x, here: + E.g. returns all the `test` nodes that are named as x, below: if x: pass @@ -691,14 +691,14 @@ class IfStmt(Flow): if c in ('elif', 'if'): yield self.children[i + 1] - def node_in_which_check_node(self, node): + def in_which_test_node(self, node): """ - Returns the check node (see function above) that a node is contained - in. However if it the node is in the check node itself and not in the + Returns the test node (see function above) that a node is contained + in. However if the node is in the test node itself and not in the suite return None. """ start_pos = node.start_pos - for check_node in reversed(list(self.get_check_nodes())): + for check_node in reversed(list(self.get_test_nodes())): if check_node.start_pos < start_pos: if start_pos < check_node.end_pos: return None