diff --git a/evaluate.py b/evaluate.py index a89b7c37..964af997 100644 --- a/evaluate.py +++ b/evaluate.py @@ -314,7 +314,6 @@ class Function(object): This is also the places where the decorators are processed. """ f = self.base_func - print 'dec', f # only enter it, if has not already been processed if not self.is_decorated: @@ -347,7 +346,6 @@ class Function(object): debug.dbg('decorator end', f) if f != self.base_func and isinstance(f, parsing.Function): f = Function(f) - print 'enddec', f return f def __getattr__(self, name): @@ -455,7 +453,6 @@ class Execution(Executable): result.append(self_name) param_dict = {} - print 'base', self.base, self.base.params for param in self.base.params: param_dict[str(param.get_name())] = param # There may be calls, which don't fit all the params, this just ignores @@ -582,8 +579,6 @@ class Execution(Executable): Call the default method with the own instance (self implements all the necessary functions). Add also the params. """ - a = self.get_params() - print 'params', a return self.get_params() + parsing.Scope._get_set_vars(self) @property diff --git a/parsing.py b/parsing.py index 98b53eb4..133ce7b2 100644 --- a/parsing.py +++ b/parsing.py @@ -363,6 +363,8 @@ class Flow(Scope): :type set_vars: list """ def __init__(self, command, inits, indent, line_nr, set_vars=None): + self._parent = None + self.next = None super(Flow, self).__init__(indent, line_nr, '') self.command = command # These have to be statements, because of with, which takes multiple. @@ -375,7 +377,16 @@ class Flow(Scope): self.set_vars = set_vars for s in self.set_vars: s.parent = self - self.next = None + + @property + def parent(self): + return self._parent + + @parent.setter + def parent(self, value): + self._parent = value + if self.next: + self.next.parent = value def get_code(self, first_indent=False, indention=" "): if self.set_vars: diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 50eb16eb..bfe9a903 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -110,5 +110,6 @@ def memoize(function): def follow_statement(stmt): return stmt +# here we had problems with the else clause, because the parent was not right. #? int() follow_statement(1)