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