mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 02:27:06 +08:00
Don't search for usages when we are working with params
This commit is contained in:
@@ -116,13 +116,18 @@ def find_references(module_context, tree_name):
|
|||||||
found_names_dct = _dictionarize(found_names)
|
found_names_dct = _dictionarize(found_names)
|
||||||
|
|
||||||
module_contexts = set(d.get_root_context() for d in found_names)
|
module_contexts = set(d.get_root_context() for d in found_names)
|
||||||
|
module_contexts = [module_context] + [m for m in module_contexts if m != module_context]
|
||||||
|
# For param no search for other modules is necessary.
|
||||||
|
if any(n.api_type == 'param' for n in found_names):
|
||||||
|
potential_modules = module_contexts
|
||||||
|
else:
|
||||||
|
potential_modules = get_module_contexts_containing_name(
|
||||||
|
inf,
|
||||||
|
module_contexts,
|
||||||
|
search_name
|
||||||
|
)
|
||||||
|
|
||||||
non_matching_reference_maps = {}
|
non_matching_reference_maps = {}
|
||||||
potential_modules = get_module_contexts_containing_name(
|
|
||||||
inf,
|
|
||||||
[module_context] + [m for m in module_contexts if m != module_context],
|
|
||||||
search_name
|
|
||||||
)
|
|
||||||
for module_context in potential_modules:
|
for module_context in potential_modules:
|
||||||
for name_leaf in module_context.tree_node.get_used_names().get(search_name, []):
|
for name_leaf in module_context.tree_node.get_used_names().get(search_name, []):
|
||||||
new = _dictionarize(_find_names(module_context, name_leaf))
|
new = _dictionarize(_find_names(module_context, name_leaf))
|
||||||
@@ -234,7 +239,7 @@ def get_module_contexts_containing_name(inference_state, module_contexts, name):
|
|||||||
continue
|
continue
|
||||||
yield module_context
|
yield module_context
|
||||||
|
|
||||||
if len(name) <= 2 or name == 'self':
|
if len(name) <= 2:
|
||||||
return
|
return
|
||||||
|
|
||||||
file_io_count = 0
|
file_io_count = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user