1
0
forked from VimPlug/jedi

Fix issues caused by KeywordStatement, which needs to be copied as well.

This commit is contained in:
Dave Halter
2014-08-21 16:51:00 +02:00
parent 0ef030848d
commit 039a5ecaf9
2 changed files with 5 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ def fast_parent_copy(obj, new_elements_default=None):
Much, much faster than copy.deepcopy, but just for certain elements. Much, much faster than copy.deepcopy, but just for certain elements.
""" """
new_elements = new_elements_default or {} new_elements = new_elements_default or {}
accept = (pr.Simple, pr.NamePart) accept = (pr.Simple, pr.NamePart, pr.KeywordStatement)
def recursion(obj): def recursion(obj):
if isinstance(obj, pr.Statement): if isinstance(obj, pr.Statement):

View File

@@ -537,9 +537,12 @@ class FunctionExecution(Executed):
continue continue
check = flow_analysis.break_check(self._evaluator, self, r.parent) check = flow_analysis.break_check(self._evaluator, self, r.parent)
if check is not flow_analysis.UNREACHABLE: if check is flow_analysis.UNREACHABLE:
debug.dbg('Return unreachable: %s', r)
else:
types += self._evaluator.eval_statement(stmt) types += self._evaluator.eval_statement(stmt)
if check is flow_analysis.REACHABLE: if check is flow_analysis.REACHABLE:
debug.dbg('Return reachable: %s', r)
break break
return types return types
@@ -594,8 +597,6 @@ class FunctionExecution(Executed):
@memoize_default() @memoize_default()
def _scope_copy(self, scope): def _scope_copy(self, scope):
""" Copies a scope (e.g. if) in an execution """ """ Copies a scope (e.g. if) in an execution """
# TODO method uses different scopes than the subscopes property.
# just check the start_pos, sometimes it's difficult with closures # just check the start_pos, sometimes it's difficult with closures
# to compare the scopes directly. # to compare the scopes directly.
if scope.start_pos == self.start_pos: if scope.start_pos == self.start_pos: