mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-22 05:11:25 +08:00
get_code is now able to process returns again
This commit is contained in:
@@ -178,8 +178,11 @@ class Scope(Simple):
|
|||||||
string += i.get_code()
|
string += i.get_code()
|
||||||
for sub in self.subscopes:
|
for sub in self.subscopes:
|
||||||
string += sub.get_code(first_indent=True, indention=indention)
|
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:
|
if first_indent:
|
||||||
string = common.indent_block(string, indention=indention)
|
string = common.indent_block(string, indention=indention)
|
||||||
@@ -1536,7 +1539,7 @@ class PyFuzzyParser(object):
|
|||||||
start_pos = self.start_pos
|
start_pos = self.start_pos
|
||||||
while tok !=':':
|
while tok !=':':
|
||||||
param, tok = self._parse_statement(
|
param, tok = self._parse_statement(
|
||||||
added_breaks=[':', ','])
|
added_breaks=[':', ','], stmt_class=Param)
|
||||||
if param is None:
|
if param is None:
|
||||||
break
|
break
|
||||||
params.append(param)
|
params.append(param)
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ a()
|
|||||||
|
|
||||||
x = []
|
x = []
|
||||||
a = lambda x: x
|
a = lambda x: x
|
||||||
int()
|
#? int()
|
||||||
a(0)
|
a(0)
|
||||||
|
|
||||||
#? float()
|
#? float()
|
||||||
|
|||||||
Reference in New Issue
Block a user