Avoid creating the same object twice

This commit is contained in:
Dave Halter
2019-09-05 00:37:51 +02:00
parent 8cd5932fed
commit 008e9860a8
2 changed files with 2 additions and 3 deletions

View File

@@ -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

View File

@@ -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)