mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-18 19:45:57 +08:00
found list indexing issue with sith and fixed it.
This commit is contained in:
@@ -86,14 +86,15 @@ def builtins_reversed(evaluator, obj, params):
|
|||||||
objects = _follow_param(evaluator, params, 0)
|
objects = _follow_param(evaluator, params, 0)
|
||||||
if objects:
|
if objects:
|
||||||
# unpack the iterator values
|
# unpack the iterator values
|
||||||
objects = iterable.get_iterator_types(objects)
|
objects = tuple(iterable.get_iterator_types(objects))
|
||||||
rev = reversed(objects)
|
if objects:
|
||||||
# Repack iterator values and then run it the normal way. This is necessary,
|
rev = reversed(objects)
|
||||||
# because `reversed` is a function and autocompletion would fail in certain
|
# Repack iterator values and then run it the normal way. This is
|
||||||
# cases like `reversed(x).__iter__` if we just returned the result
|
# necessary, because `reversed` is a function and autocompletion
|
||||||
# directly.
|
# would fail in certain cases like `reversed(x).__iter__` if we
|
||||||
stmts = [FakeStatement([r]) for r in rev]
|
# just returned the result directly.
|
||||||
objects = (FakeArray(stmts, objects[0].parent),)
|
stmts = [FakeStatement([r]) for r in rev]
|
||||||
|
objects = (FakeArray(stmts, objects[0].parent),)
|
||||||
return [er.Instance(evaluator, obj, objects)]
|
return [er.Instance(evaluator, obj, objects)]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ sorted(arr)[0]
|
|||||||
#? str()
|
#? str()
|
||||||
next(reversed(arr))
|
next(reversed(arr))
|
||||||
|
|
||||||
|
# should not fail if there's no return value.
|
||||||
|
def yielder():
|
||||||
|
yield None
|
||||||
|
|
||||||
|
#?
|
||||||
|
next(reversed(yielder()))
|
||||||
|
|
||||||
#? str()
|
#? str()
|
||||||
next(open(''))
|
next(open(''))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user