found list indexing issue with sith and fixed it.

This commit is contained in:
Dave Halter
2014-04-16 01:31:49 +02:00
parent 62bd8bd8ef
commit a341791fda
2 changed files with 16 additions and 8 deletions

View File

@@ -86,12 +86,13 @@ def builtins_reversed(evaluator, obj, params):
objects = _follow_param(evaluator, params, 0)
if objects:
# unpack the iterator values
objects = iterable.get_iterator_types(objects)
objects = tuple(iterable.get_iterator_types(objects))
if objects:
rev = reversed(objects)
# Repack iterator values and then run it the normal way. This is necessary,
# because `reversed` is a function and autocompletion would fail in certain
# cases like `reversed(x).__iter__` if we just returned the result
# directly.
# Repack iterator values and then run it the normal way. This is
# necessary, because `reversed` is a function and autocompletion
# would fail in certain cases like `reversed(x).__iter__` if we
# just returned the result directly.
stmts = [FakeStatement([r]) for r in rev]
objects = (FakeArray(stmts, objects[0].parent),)
return [er.Instance(evaluator, obj, objects)]

View File

@@ -13,6 +13,13 @@ sorted(arr)[0]
#? str()
next(reversed(arr))
# should not fail if there's no return value.
def yielder():
yield None
#?
next(reversed(yielder()))
#? str()
next(open(''))