forked from VimPlug/jedi
Recursions on if statements when using the advanced flow evaluation shouldn't be possible anymore.
This commit is contained in:
@@ -367,10 +367,11 @@ class Evaluator(object):
|
|||||||
return types
|
return types
|
||||||
|
|
||||||
def goto_definition(self, name):
|
def goto_definition(self, name):
|
||||||
|
# TODO rename to goto_definitions
|
||||||
def_ = name.get_definition()
|
def_ = name.get_definition()
|
||||||
if def_.type == 'expr_stmt' and name in def_.get_defined_names():
|
if def_.type == 'expr_stmt' and name in def_.get_defined_names():
|
||||||
return self.eval_statement(def_, name)
|
return self.eval_statement(def_, name)
|
||||||
call = helpers.call_of_name(name)
|
call = helpers.call_of_name(name, True)
|
||||||
return self.eval_element(call)
|
return self.eval_element(call)
|
||||||
|
|
||||||
def goto(self, name):
|
def goto(self, name):
|
||||||
|
|||||||
+11
-6
@@ -169,12 +169,18 @@ class NameFinder(object):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
check = flow_analysis.break_check(self._evaluator, self.scope,
|
if self.name_str.start_pos < scope.end_pos:
|
||||||
origin_scope)
|
# It doesn't make any sense to check if
|
||||||
if check is flow_analysis.UNREACHABLE:
|
# statements in the if statement itself, just
|
||||||
self._found_predefined_if_name = []
|
# deliver types.
|
||||||
else:
|
|
||||||
self._found_predefined_if_name = types
|
self._found_predefined_if_name = types
|
||||||
|
else:
|
||||||
|
check = flow_analysis.break_check(self._evaluator, self.scope,
|
||||||
|
origin_scope)
|
||||||
|
if check is flow_analysis.UNREACHABLE:
|
||||||
|
self._found_predefined_if_name = []
|
||||||
|
else:
|
||||||
|
self._found_predefined_if_name = types
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
origin_scope = None
|
origin_scope = None
|
||||||
@@ -189,7 +195,6 @@ class NameFinder(object):
|
|||||||
|
|
||||||
if check is flow_analysis.REACHABLE:
|
if check is flow_analysis.REACHABLE:
|
||||||
break
|
break
|
||||||
last_names.append(name)
|
|
||||||
|
|
||||||
if isinstance(name_scope, er.FunctionExecution):
|
if isinstance(name_scope, er.FunctionExecution):
|
||||||
# Replace params
|
# Replace params
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ def break_check(evaluator, base_scope, stmt, origin_scope=None):
|
|||||||
return REACHABLE
|
return REACHABLE
|
||||||
origin_scope = origin_scope.parent
|
origin_scope = origin_scope.parent
|
||||||
"""
|
"""
|
||||||
return _break_check(evaluator, stmt, base_scope, element_scope)
|
x = _break_check(evaluator, stmt, base_scope, element_scope)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
def _break_check(evaluator, stmt, base_scope, element_scope):
|
def _break_check(evaluator, stmt, base_scope, element_scope):
|
||||||
|
|||||||
Reference in New Issue
Block a user