diff --git a/jedi/parsing.py b/jedi/parsing.py index 8388e6ae..f553f238 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -178,8 +178,11 @@ class Scope(Simple): string += i.get_code() for sub in self.subscopes: string += sub.get_code(first_indent=True, indention=indention) - for stmt in self.statements: - string += stmt.get_code() + + returns = self.returns if hasattr(self, 'returns') else [] + ret_str = '' if isinstance(self, Lambda) else 'return ' + for stmt in self.statements + returns: + string += (ret_str if stmt in returns else '') + stmt.get_code() if first_indent: string = common.indent_block(string, indention=indention) @@ -1536,7 +1539,7 @@ class PyFuzzyParser(object): start_pos = self.start_pos while tok !=':': param, tok = self._parse_statement( - added_breaks=[':', ',']) + added_breaks=[':', ','], stmt_class=Param) if param is None: break params.append(param) diff --git a/test/completion/functions.py b/test/completion/functions.py index cc6df344..421a34b4 100644 --- a/test/completion/functions.py +++ b/test/completion/functions.py @@ -365,7 +365,7 @@ a() x = [] a = lambda x: x -int() +#? int() a(0) #? float()