refactored return/yield parsing, fixes davidhalter/jedi-vim#49

This commit is contained in:
David Halter committed 2012-12-18 15:35:59 +01:00
1 parent e09b578608
commit df95416160
2 files changed
+34 -37

No files matched your search

+9 -5
View File
@@ -462,7 +462,8 @@ class Execution(Executable):
else:
stmts = []
for r in self.returns:
stmts += follow_statement(r)
if r is not None:
stmts += follow_statement(r)
return stmts
@cache.memoize_default(default=[])
@@ -641,10 +642,13 @@ class Execution(Executable):
attr = getattr(self.base, prop)
objects = []
for element in attr:
copied = helpers.fast_parent_copy(element)
copied.parent = self._scope_copy(copied.parent)
if isinstance(copied, parsing.Function):
copied = Function(copied)
if element is None:
copied = element
else:
copied = helpers.fast_parent_copy(element)
copied.parent = self._scope_copy(copied.parent)
if isinstance(copied, parsing.Function):
copied = Function(copied)
objects.append(copied)
return objects