diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 750b0dc4..e970a659 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -280,7 +280,7 @@ class Evaluator(object): if element.value in ('False', 'True', 'None'): types.add(compiled.builtin_from_name(self, element.value)) # else: print e.g. could be evaluated like this in Python 2.7 - elif typ == 'lambda': + elif typ == 'lambdef': types = set([er.FunctionContext(self, context, element)]) elif typ == 'expr_stmt': types = self.eval_statement(context, element) @@ -337,7 +337,7 @@ class Evaluator(object): # This is the first global lookup. stmt = atom.get_definition() if stmt.type == 'comp_for': - stmt = tree.search_ancestor(stmt, ('expr_stmt', 'lambda', 'funcdef', 'classdef')) + stmt = tree.search_ancestor(stmt, ('expr_stmt', 'lambdef', 'funcdef', 'classdef')) if stmt is None or stmt.type != 'expr_stmt': # We only need to adjust the start_pos for statements, because # there the name cannot be used. @@ -551,7 +551,7 @@ class Evaluator(object): if scope_node == base_node: return base_context - is_funcdef = scope_node.type in ('funcdef', 'lambda') + is_funcdef = scope_node.type in ('funcdef', 'lambdef') parent_scope = scope_node.get_parent_scope() parent_context = from_scope_node(parent_scope, child_is_funcdef=is_funcdef) diff --git a/jedi/evaluate/docstrings.py b/jedi/evaluate/docstrings.py index 7ebd963a..08fb6aa1 100644 --- a/jedi/evaluate/docstrings.py +++ b/jedi/evaluate/docstrings.py @@ -192,7 +192,7 @@ def follow_param(module_context, param): for p in _evaluate_for_statement_string(module_context, param_str)] ) func = param.get_parent_function() - if func.type == 'lambda': + if func.type == 'lambdef': return set() types = eval_docstring(func.raw_doc) diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 65fa77c6..58202af3 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -290,7 +290,7 @@ class FunctionContext(use_metaclass(CachedMetaClass, context.TreeContext)): @property def name(self): - if self.tree_node.type == 'lambda': + if self.tree_node.type == 'lambdef': return LambdaName(self) return ContextName(self, self.tree_node.name) @@ -320,7 +320,7 @@ class FunctionExecutionContext(context.TreeContext): @recursion.execution_recursion_decorator() def get_return_values(self, check_yields=False): funcdef = self.tree_node - if funcdef.type == 'lambda': + if funcdef.type == 'lambdef': return self.evaluator.eval_element(self, funcdef.children[-1]) if check_yields: diff --git a/jedi/parser/python/tree.py b/jedi/parser/python/tree.py index 0d108212..a409f948 100644 --- a/jedi/parser/python/tree.py +++ b/jedi/parser/python/tree.py @@ -634,7 +634,7 @@ class Lambda(Function): -2) -1) Node() representing body """ - type = 'lambda' + type = 'lambdef' __slots__ = () def __init__(self, children): @@ -1084,7 +1084,7 @@ class Param(PythonBaseNode): return index - 1 def get_parent_function(self): - return search_ancestor(self, ('funcdef', 'lambda')) + return search_ancestor(self, ('funcdef', 'lambdef')) def get_description(self): # TODO Remove? diff --git a/test/test_parser/test_parser_tree.py b/test/test_parser/test_parser_tree.py index 34421b5f..2df287c9 100644 --- a/test/test_parser/test_parser_tree.py +++ b/test/test_parser/test_parser_tree.py @@ -36,7 +36,7 @@ class TestsFunctionAndLambdaParsing(object): return request.keywords['expected'] def test_name(self, node, expected): - if node.type != 'lambda': + if node.type != 'lambdef': assert isinstance(node.name, tree.Name) assert unicode(node.name) == u(expected['name'])