forked from VimPlug/jedi
Fix some issues with array arguments.
This commit is contained in:
@@ -16,7 +16,8 @@ class Arguments(pr.Base):
|
||||
def __init__(self, evaluator, argument_node, trailer=None):
|
||||
"""
|
||||
The argument_node is either a parser node or a list of evaluated
|
||||
objects.
|
||||
objects. Those evaluated objects may be lists of evaluated objects
|
||||
themselves (one list for the first argument, one for the second, etc).
|
||||
"""
|
||||
self.argument_node = argument_node
|
||||
self._evaluator = evaluator
|
||||
@@ -68,6 +69,8 @@ class Arguments(pr.Base):
|
||||
else:
|
||||
if pr.is_node(el, 'argument'):
|
||||
named_args.append((el.children[0].value, (el.children[2],)))
|
||||
elif isinstance(el, (list, tuple)):
|
||||
yield None, el
|
||||
else:
|
||||
yield None, (el,)
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
||||
yield self, [get_instance_el(self._evaluator, self, var, True)
|
||||
for var in names]
|
||||
|
||||
def get_index_types(self, index_array):
|
||||
def get_index_types(self, evaluator, index_array):
|
||||
|
||||
indexes = iterable.create_indexes_or_slices(self._evaluator, index_array)
|
||||
if any([isinstance(i, iterable.Slice) for i in indexes]):
|
||||
@@ -208,9 +208,8 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
||||
# TODO support slices in a more general way.
|
||||
indexes = []
|
||||
|
||||
index = helpers.FakeStatement(indexes, parent=compiled.builtin)
|
||||
try:
|
||||
return self.execute_subscope_by_name('__getitem__', [index])
|
||||
return self.execute_subscope_by_name('__getitem__', [indexes])
|
||||
except KeyError:
|
||||
debug.warning('No __getitem__, cannot access the array.')
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user