forked from VimPlug/jedi
named param goto.
This commit is contained in:
@@ -290,33 +290,7 @@ def get_module_name_parts(module):
|
||||
Returns a dictionary with name parts as keys and their call paths as
|
||||
values.
|
||||
"""
|
||||
def scope_name_parts(scope):
|
||||
for s in scope.subscopes:
|
||||
# Yield the name parts, not names.
|
||||
yield s.name
|
||||
for need_yield_from in scope_name_parts(s):
|
||||
yield need_yield_from
|
||||
|
||||
statements_or_imports = set(chain(*module.used_names.values()))
|
||||
name_parts = set(scope_name_parts(module))
|
||||
for stmt_or_import in statements_or_imports:
|
||||
if isinstance(stmt_or_import, pr.Import):
|
||||
for name in stmt_or_import.get_all_import_names():
|
||||
name_parts.add(name)
|
||||
else:
|
||||
# Running this ensures that all the expression lists are generated
|
||||
# and the parents are all set. (Important for Lambdas) Howeer, this
|
||||
# is only necessary because of the weird fault-tolerant structure
|
||||
# of the parser. I hope to get rid of such behavior in the future.
|
||||
stmt_or_import.expression_list()
|
||||
# For now this is ok, but this could change if we don't have a
|
||||
# token_list anymore, but for now this is the easiest way to get
|
||||
# all the name_parts.
|
||||
for tok in stmt_or_import._token_list:
|
||||
if isinstance(tok, pr.Name):
|
||||
name_parts.add(tok)
|
||||
|
||||
return name_parts
|
||||
return chain.from_iterable(module.used_names.values())
|
||||
|
||||
|
||||
def statement_elements_in_statement(stmt):
|
||||
|
||||
Reference in New Issue
Block a user