summaryrefslogtreecommitdiff
path: root/rebuilder.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2009-03-24 09:35:56 +0100
committerSylvain Thénault <sylvain.thenault@logilab.fr>2009-03-24 09:35:56 +0100
commita8ae7b8240ec5884cf70945370e4fd9bcbfb9c4e (patch)
tree4696bc26b8102096ae13f5fba43bed02c8867937 /rebuilder.py
parent9f84453ce29952433660704a2ecc5ac8ed53c10e (diff)
downloadastroid-git-a8ae7b8240ec5884cf70945370e4fd9bcbfb9c4e.tar.gz
some understanding of the __builtin__.property decorator
Diffstat (limited to 'rebuilder.py')
-rw-r--r--rebuilder.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/rebuilder.py b/rebuilder.py
index 80ec28cb..90047215 100644
--- a/rebuilder.py
+++ b/rebuilder.py
@@ -130,18 +130,22 @@ class RebuildVisitor(ASTVisitor):
def leave_assign(self, node):
"""leave an Assign node to become astng"""
klass = node.parent.frame()
- if isinstance(klass, nodes.Class) and \
- isinstance(node.value, nodes.CallFunc) and \
- isinstance(node.value.func, nodes.Name):
+ if (isinstance(klass, nodes.Class)
+ and isinstance(node.value, nodes.CallFunc)
+ and isinstance(node.value.func, nodes.Name)):
func_name = node.value.func.name
- if func_name in ('classmethod', 'staticmethod'):
- for ass_node in node.targets:
- try:
- meth = klass[ass_node.name]
- if isinstance(meth, nodes.Function):
+ for ass_node in node.targets:
+ try:
+ meth = klass[ass_node.name]
+ if isinstance(meth, nodes.Function):
+ if func_name in ('classmethod', 'staticmethod'):
meth.type = func_name
- except (AttributeError, KeyError):
- continue
+ try:
+ meth.extra_decorators.append(node.value)
+ except AttributeError:
+ meth.extra_decorators = [node.value]
+ except (AttributeError, KeyError):
+ continue
elif getattr(node.targets[0], 'name', None) == '__metaclass__': # XXX check more...
self._metaclass[-1] = 'type' # XXX get the actual metaclass