goto_assignments should work even if something is only defined in a stub

This commit is contained in:
Dave Halter
2019-05-17 14:58:55 +02:00
parent 9d5f57d798
commit c640aa9213
2 changed files with 21 additions and 9 deletions

View File

@@ -62,14 +62,18 @@ def try_stub_to_actual_names(names, prefer_stub_to_compiled=False):
name_list[:-1], name_list[:-1],
ignore_compiled=prefer_stub_to_compiled, ignore_compiled=prefer_stub_to_compiled,
) )
if contexts: if contexts and name_list:
if name_list: new_names = contexts.py__getattribute__(name_list[-1], is_goto=True)
for new_name in contexts.py__getattribute__(name_list[-1], is_goto=True): for new_name in new_names:
yield new_name yield new_name
else: if new_names:
continue
elif contexts:
for c in contexts: for c in contexts:
yield c.name yield c.name
else: continue
# This is the part where if we haven't found anything, just return the
# stub name.
yield name yield name

View File

@@ -13,6 +13,14 @@ with_stub.in_with_stub_python
#? float() #? float()
with_stub.in_with_stub_stub with_stub.in_with_stub_stub
#! ['in_stub_only: int']
stub_only.in_stub_only
#! ['in_with_stub_both = 5']
with_stub.in_with_stub_both
#! ['in_with_stub_python = 8']
with_stub.in_with_stub_python
#! ['in_with_stub_stub: float']
with_stub.in_with_stub_stub
# ------------------------- # -------------------------
# Folders # Folders