mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Avoid creating the same object twice
This commit is contained in:
@@ -62,7 +62,6 @@ I need to mention now that lazy type inference is really good because it
|
||||
only *inferes* what needs to be *inferred*. All the statements and modules
|
||||
that are not used are just being ignored.
|
||||
"""
|
||||
from parso.python import tree
|
||||
import parso
|
||||
from parso import python_bytes_to_unicode
|
||||
from jedi.file_io import FileIO
|
||||
|
||||
@@ -119,13 +119,13 @@ class AbstractTreeName(AbstractNameDefinition):
|
||||
# a name it's something you can "goto" again.
|
||||
is_simple_name = name.parent.type not in ('power', 'trailer')
|
||||
if is_simple_name:
|
||||
return [TreeNameDefinition(context, name)]
|
||||
return [self]
|
||||
elif type_ in ('import_from', 'import_name'):
|
||||
from jedi.inference.imports import goto_import
|
||||
module_names = goto_import(context, name)
|
||||
return module_names
|
||||
else:
|
||||
return [TreeNameDefinition(context, name)]
|
||||
return [self]
|
||||
else:
|
||||
from jedi.inference.imports import follow_error_node_imports_if_possible
|
||||
values = follow_error_node_imports_if_possible(context, name)
|
||||
|
||||
Reference in New Issue
Block a user