forked from VimPlug/jedi
Make sure we use the right context in case of goto with decorators, fixes #1427
This commit is contained in:
@@ -252,7 +252,7 @@ class Value(HelperValueMixin, BaseValue):
|
|||||||
return self.parent_context.is_stub()
|
return self.parent_context.is_stub()
|
||||||
|
|
||||||
def _as_context(self):
|
def _as_context(self):
|
||||||
raise NotImplementedError('Not all values need to be converted to contexts')
|
raise NotImplementedError('Not all values need to be converted to contexts: %s', self)
|
||||||
|
|
||||||
|
|
||||||
def iterate_values(values, contextualized_node=None, is_async=False):
|
def iterate_values(values, contextualized_node=None, is_async=False):
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class AbstractTreeName(AbstractNameDefinition):
|
|||||||
new_dotted.children[index - 1:] = []
|
new_dotted.children[index - 1:] = []
|
||||||
values = context.infer_node(new_dotted)
|
values = context.infer_node(new_dotted)
|
||||||
return unite(
|
return unite(
|
||||||
value.goto(name, name_context=value.as_context())
|
value.goto(name, name_context=context)
|
||||||
for value in values
|
for value in values
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -330,3 +330,16 @@ import abc
|
|||||||
|
|
||||||
#? ['abstractmethod']
|
#? ['abstractmethod']
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# Goto
|
||||||
|
# -----------------
|
||||||
|
x = 1
|
||||||
|
|
||||||
|
#! 5 []
|
||||||
|
@x.foo()
|
||||||
|
def f(): pass
|
||||||
|
|
||||||
|
#! 1 ['x = 1']
|
||||||
|
@x.foo()
|
||||||
|
def f(): pass
|
||||||
|
|||||||
Reference in New Issue
Block a user