forked from VimPlug/jedi
Make generators return more correct values with while loops, fixes #683
This commit is contained in:
@@ -3,8 +3,10 @@ from jedi.common.utils import monkeypatch
|
||||
|
||||
|
||||
class AbstractLazyValue(object):
|
||||
def __init__(self, data):
|
||||
def __init__(self, data, min=1, max=1):
|
||||
self.data = data
|
||||
self.min = min
|
||||
self.max = max
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (self.__class__.__name__, self.data)
|
||||
@@ -26,16 +28,16 @@ class LazyKnownValues(AbstractLazyValue):
|
||||
|
||||
|
||||
class LazyUnknownValue(AbstractLazyValue):
|
||||
def __init__(self):
|
||||
super(LazyUnknownValue, self).__init__(None)
|
||||
def __init__(self, min=1, max=1):
|
||||
super(LazyUnknownValue, self).__init__(None, min, max)
|
||||
|
||||
def infer(self):
|
||||
return NO_VALUES
|
||||
|
||||
|
||||
class LazyTreeValue(AbstractLazyValue):
|
||||
def __init__(self, context, node):
|
||||
super(LazyTreeValue, self).__init__(node)
|
||||
def __init__(self, context, node, min=1, max=1):
|
||||
super(LazyTreeValue, self).__init__(node, min, max)
|
||||
self.context = context
|
||||
# We need to save the predefined names. It's an unfortunate side effect
|
||||
# that needs to be tracked otherwise results will be wrong.
|
||||
|
||||
Reference in New Issue
Block a user