forked from VimPlug/jedi
removed statement_path/goto_names
This commit is contained in:
@@ -31,9 +31,7 @@ import helpers
|
||||
import dynamic
|
||||
|
||||
memoize_caches = []
|
||||
statement_path = []
|
||||
faked_scopes = []
|
||||
goto_names = None
|
||||
|
||||
|
||||
class DecoratorNotFound(LookupError):
|
||||
@@ -75,7 +73,7 @@ def clear_caches():
|
||||
that should be completed after each completion finishes. The only things
|
||||
that stays is the module cache (which is not deleted here).
|
||||
"""
|
||||
global memoize_caches, statement_path, faked_scopes, goto_names
|
||||
global memoize_caches, faked_scopes
|
||||
|
||||
for m in memoize_caches:
|
||||
m.clear()
|
||||
@@ -85,20 +83,11 @@ def clear_caches():
|
||||
|
||||
# memorize_caches must never be deleted, because the dicts will get lost in
|
||||
# the wrappers.
|
||||
statement_path = []
|
||||
faked_scopes = []
|
||||
goto_names = None
|
||||
|
||||
follow_statement.reset()
|
||||
|
||||
|
||||
def statement_path_check(function):
|
||||
def wrapper(stmt, *args, **kwargs):
|
||||
statement_path.append(stmt)
|
||||
return function(stmt, *args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
|
||||
def memoize_default(default=None):
|
||||
"""
|
||||
This is a typical memoization decorator, BUT there is one difference:
|
||||
@@ -1026,7 +1015,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
||||
and r.position_nr > 0: # 0 would be self
|
||||
r = func.var.params[r.position_nr]
|
||||
if not r.is_generated:
|
||||
statement_path.append(r)
|
||||
res_new += dynamic.search_params(r)
|
||||
if not r.assignment_details:
|
||||
# this means that there are no default params,
|
||||
@@ -1092,7 +1080,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
||||
# place, if the var_args are clear. But sometimes the class is
|
||||
# not known. Therefore add a new instance for self. Otherwise
|
||||
# take the existing.
|
||||
statement_path.append(par)
|
||||
if isinstance(scope, InstanceElement):
|
||||
inst = scope.instance
|
||||
else:
|
||||
@@ -1145,8 +1132,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
||||
and isinstance(p.var, parsing.Class):
|
||||
p = p.var
|
||||
if name_str == name.get_code() and p not in break_scopes:
|
||||
if goto_names is not None:
|
||||
goto_names.append(name)
|
||||
r, no_break_scope = process(name)
|
||||
if is_goto:
|
||||
result.append(name)
|
||||
@@ -1185,8 +1170,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
||||
res_new.append(r)
|
||||
return res_new
|
||||
|
||||
if goto_names:
|
||||
return [] # goto has already been used.
|
||||
if search_global:
|
||||
scope_generator = get_names_for_scope(scope, position=position)
|
||||
else:
|
||||
@@ -1314,7 +1297,6 @@ def assign_tuples(tup, results, seek_name):
|
||||
|
||||
|
||||
@helpers.RecursionDecorator
|
||||
@statement_path_check
|
||||
@memoize_default(default=[])
|
||||
def follow_statement(stmt, seek_name=None):
|
||||
"""
|
||||
|
||||
@@ -237,8 +237,6 @@ def strip_imports(scopes):
|
||||
result = []
|
||||
for s in scopes:
|
||||
if isinstance(s, parsing.Import):
|
||||
# this is something like a statement following.
|
||||
evaluate.statement_path.append(s)
|
||||
result += ImportPath(s).follow()
|
||||
else:
|
||||
result.append(s)
|
||||
|
||||
Reference in New Issue
Block a user