By trying to get rid of search_name in usages, we had to fix an issue with imports:
If used like 'follow(is_goto)', it could return a ModuleWrapper instead of a Name, which is what we actually want.
This commit is contained in:
1 parent
59578966cf
commit
18204c4c19
5 files changed
+25
-13
No files matched your search
@@ -188,10 +188,12 @@ class CompiledObject(Base):
|
||||
pass # self.obj maynot have an __iter__ method.
|
||||
return result
|
||||
|
||||
"""
|
||||
@property
|
||||
def name(self):
|
||||
# might not exist sometimes (raises AttributeError)
|
||||
return self._cls().obj.__name__
|
||||
"""
|
||||
|
||||
def _execute_function(self, evaluator, params):
|
||||
if self.type() != 'function':
|
||||
|
||||
@@ -194,6 +194,10 @@ class ImportWrapper(pr.Base):
|
||||
if star_imports:
|
||||
scopes = [StarImportModule(scopes[0], star_imports)]
|
||||
|
||||
# goto only accepts Names or NameParts
|
||||
if is_goto and not rest:
|
||||
scopes = [s.name for s in scopes]
|
||||
|
||||
# follow the rest of the import (not FS -> classes, functions)
|
||||
if len(rest) > 1 or rest and self.is_like_search:
|
||||
scopes = []
|
||||
|
||||
Reference in new issue
Block a user