forked from VimPlug/jedi
simplify evaluator.execute, because now everything is using py__call__
This commit is contained in:
@@ -312,7 +312,7 @@ class Evaluator(object):
|
|||||||
return self.follow_path(path, result, scope)
|
return self.follow_path(path, result, scope)
|
||||||
|
|
||||||
@debug.increase_indent
|
@debug.increase_indent
|
||||||
def execute(self, obj, params=(), evaluate_generator=False):
|
def execute(self, obj, params=()):
|
||||||
if obj.isinstance(er.Function):
|
if obj.isinstance(er.Function):
|
||||||
obj = obj.get_decorated_func()
|
obj = obj.get_decorated_func()
|
||||||
|
|
||||||
@@ -324,28 +324,15 @@ class Evaluator(object):
|
|||||||
except stdlib.NotInStdLib:
|
except stdlib.NotInStdLib:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if isinstance(obj, iterable.GeneratorMethod):
|
try:
|
||||||
return obj.py__call__(self, params)
|
func = obj.py__call__
|
||||||
elif obj.isinstance(compiled.CompiledObject):
|
except AttributeError:
|
||||||
return obj.py__call__(self, params)
|
debug.warning("no execution possible %s", obj)
|
||||||
elif obj.isinstance(er.Class):
|
return []
|
||||||
# There maybe executions of executions.
|
|
||||||
return obj.py__call__(self, params)
|
|
||||||
else:
|
else:
|
||||||
stmts = []
|
types = func(self, params)
|
||||||
if obj.isinstance(er.Function):
|
debug.dbg('execute result: %s in %s', types, obj)
|
||||||
return obj.py__call__(self, params, evaluate_generator)
|
return types
|
||||||
else:
|
|
||||||
try:
|
|
||||||
func = obj.py__call__
|
|
||||||
except AttributeError:
|
|
||||||
debug.warning("no execution possible %s", obj)
|
|
||||||
return []
|
|
||||||
else:
|
|
||||||
return func(self, params)
|
|
||||||
|
|
||||||
debug.dbg('execute result: %s in %s', stmts, obj)
|
|
||||||
return imports.follow_imports(self, stmts)
|
|
||||||
|
|
||||||
def goto(self, stmt, call_path):
|
def goto(self, stmt, call_path):
|
||||||
scope = stmt.get_parent_until(pr.IsScope)
|
scope = stmt.get_parent_until(pr.IsScope)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class Generator(use_metaclass(CachedMetaClass, pr.Base)):
|
|||||||
|
|
||||||
def iter_content(self):
|
def iter_content(self):
|
||||||
""" returns the content of __iter__ """
|
""" returns the content of __iter__ """
|
||||||
return self._evaluator.execute(self.func, self.var_args, True)
|
return self.func.py__call__(self._evaluator, self.var_args, True)
|
||||||
|
|
||||||
def get_index_types(self, index_array):
|
def get_index_types(self, index_array):
|
||||||
#debug.warning('Tried to get array access on a generator: %s', self)
|
#debug.warning('Tried to get array access on a generator: %s', self)
|
||||||
|
|||||||
Reference in New Issue
Block a user