1
0
forked from VimPlug/jedi

Get lambdas mostly working.

This commit is contained in:
Dave Halter
2014-12-01 02:47:48 +01:00
parent 4ee5ad4ce3
commit 88853c78f4
5 changed files with 61 additions and 34 deletions

View File

@@ -76,7 +76,7 @@ class Executed(pr.Base):
return True
def get_parent_until(self, *args, **kwargs):
return self.base.get_parent_until(*args, **kwargs)
return pr.Base.get_parent_until(self, *args, **kwargs)
@common.safe_property
def parent(self):
@@ -512,7 +512,7 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
debug.dbg('decorator end %s', f)
if isinstance(f, pr.Function):
if isinstance(f, (pr.Function, pr.Lambda)):
return self
return f
@@ -542,6 +542,10 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
return "<e%s of %s%s>" % (type(self).__name__, self.base_func, dec)
class LambdaWrapper(Function):
pass
class LazyDict(object):
def __init__(self, old_dct, copy_func):
self._copy_func = copy_func
@@ -588,6 +592,9 @@ class FunctionExecution(Executed):
# inserted params, not in the actual execution of the function.
return []
if isinstance(func, LambdaWrapper):
return self._evaluator.eval_element(self.children[-1])
if check_yields:
types = []
returns = self.yields