forked from VimPlug/jedi
lambdas: add correct parents and change evaluate
This commit is contained in:
@@ -1374,8 +1374,8 @@ def follow_call_list(call_list):
|
|||||||
result += follow_statement(stmt)
|
result += follow_statement(stmt)
|
||||||
else:
|
else:
|
||||||
# With things like params, these can also be functions...
|
# With things like params, these can also be functions...
|
||||||
if isinstance(call, (Function, Class, Instance,
|
if isinstance(call, (parsing.Lambda, Function, Class,
|
||||||
dynamic.ArrayInstance)):
|
Instance, dynamic.ArrayInstance)):
|
||||||
result.append(call)
|
result.append(call)
|
||||||
# The string tokens are just operations (+, -, etc.)
|
# The string tokens are just operations (+, -, etc.)
|
||||||
elif not isinstance(call, (str, unicode)):
|
elif not isinstance(call, (str, unicode)):
|
||||||
|
|||||||
@@ -1546,7 +1546,11 @@ class PyFuzzyParser(object):
|
|||||||
lambd = Lambda(self.module, params, start_pos)
|
lambd = Lambda(self.module, params, start_pos)
|
||||||
ret, tok = self._parse_statement(added_breaks=[','])
|
ret, tok = self._parse_statement(added_breaks=[','])
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
|
ret.parent = lambd
|
||||||
lambd.returns.append(ret)
|
lambd.returns.append(ret)
|
||||||
|
lambd.parent = self.scope
|
||||||
|
tok_list[-1] = lambd
|
||||||
|
continue
|
||||||
elif token_type == tokenize.NAME:
|
elif token_type == tokenize.NAME:
|
||||||
if tok == 'for':
|
if tok == 'for':
|
||||||
# list comprehensions!
|
# list comprehensions!
|
||||||
|
|||||||
Reference in New Issue
Block a user