forked from VimPlug/jedi
Fix generator issues that were caused by the small refactoring
This commit is contained in:
@@ -146,8 +146,10 @@ class AbstractInstanceContext(Context):
|
|||||||
def py__getitem__(self, index_context_set, contextualized_node):
|
def py__getitem__(self, index_context_set, contextualized_node):
|
||||||
names = self.get_function_slot_names(u'__getitem__')
|
names = self.get_function_slot_names(u'__getitem__')
|
||||||
if not names:
|
if not names:
|
||||||
debug.warning('Found no __getitem__ on %s', self)
|
return super(AbstractInstanceContext, self).py__getitem__(
|
||||||
return NO_CONTEXTS
|
index_context_set,
|
||||||
|
contextualized_node,
|
||||||
|
)
|
||||||
|
|
||||||
args = ValuesArguments([index_context_set])
|
args = ValuesArguments([index_context_set])
|
||||||
return ContextSet.from_sets(name.infer().execute(args) for name in names)
|
return ContextSet.from_sets(name.infer().execute(args) for name in names)
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ class GeneratorBase(LazyAttributeOverwrite, IterableMixin):
|
|||||||
.execute_annotation()
|
.execute_annotation()
|
||||||
return generator
|
return generator
|
||||||
|
|
||||||
|
def is_instance(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def py__bool__(self):
|
||||||
|
return True
|
||||||
|
|
||||||
@publish_method('__iter__')
|
@publish_method('__iter__')
|
||||||
def py__iter__(self, contextualized_node=None):
|
def py__iter__(self, contextualized_node=None):
|
||||||
return ContextSet([self])
|
return ContextSet([self])
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ def _apply_decorators(context, node):
|
|||||||
decoratee_context = FunctionContext.from_context(context, node)
|
decoratee_context = FunctionContext.from_context(context, node)
|
||||||
initial = values = ContextSet([decoratee_context])
|
initial = values = ContextSet([decoratee_context])
|
||||||
for dec in reversed(node.get_decorators()):
|
for dec in reversed(node.get_decorators()):
|
||||||
debug.dbg('decorator: %s %s', dec, values)
|
debug.dbg('decorator: %s %s', dec, values, color="MAGENTA")
|
||||||
with debug.increase_indent_cm():
|
with debug.increase_indent_cm():
|
||||||
dec_values = context.eval_node(dec.children[1])
|
dec_values = context.eval_node(dec.children[1])
|
||||||
trailer_nodes = dec.children[2:-1]
|
trailer_nodes = dec.children[2:-1]
|
||||||
@@ -663,7 +663,7 @@ def _apply_decorators(context, node):
|
|||||||
debug.warning('not possible to resolve wrappers found %s', node)
|
debug.warning('not possible to resolve wrappers found %s', node)
|
||||||
return initial
|
return initial
|
||||||
|
|
||||||
debug.dbg('decorator end %s', values)
|
debug.dbg('decorator end %s', values, color="MAGENTA")
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user