function decorator support (only written with functions)

This commit is contained in:
David Halter
2012-05-10 11:08:08 +02:00
parent 17f059e853
commit 49ef3dcace
4 changed files with 135 additions and 24 deletions

View File

@@ -104,6 +104,10 @@ class Scope(Simple):
# print 'push scope: [%s@%s]' % (sub.line_nr, sub.indent)
sub.parent = self
sub.decorators = decorators
for d in decorators:
# the parent is the same, because the decorator has not the scope
# of the function
d.parent = sub.parent
self.subscopes.append(sub)
return sub
@@ -308,6 +312,9 @@ class Function(Scope):
for p in params:
p.parent = self
self.decorators = []
# helper variable for the evaluator, maybe remove this, when
# evaluate.py is rewritten, fully functional.
self.is_decorated = False
self.returns = []
self.is_generator = False