diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-09-27 18:41:23 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-09-27 18:41:23 +0200 |
commit | d110bcf2de4b8bc48e41638cf430f17c5714ffbc (patch) | |
tree | 52402738682049b593a4eee871b16ebadc01bc3d /rebuilder.py | |
parent | 9609f63ee0c5cd1f52283fea5d1ae8c184f849b0 (diff) | |
download | astroid-git-d110bcf2de4b8bc48e41638cf430f17c5714ffbc.tar.gz |
closes #77188: support lgc.decorators.classproperty
Diffstat (limited to 'rebuilder.py')
-rw-r--r-- | rebuilder.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/rebuilder.py b/rebuilder.py index ad214758..bac7a095 100644 --- a/rebuilder.py +++ b/rebuilder.py @@ -211,6 +211,8 @@ class TreeRebuilder(object): if isinstance(meth, new.Function): if func_name in ('classmethod', 'staticmethod'): meth.type = func_name + elif func_name == 'classproperty': # see lgc.decorators + meth.type = 'classmethod' meth.extra_decorators.append(newnode.value) except (AttributeError, KeyError): continue @@ -486,9 +488,11 @@ class TreeRebuilder(object): newnode.type = 'method' if newnode.decorators is not None: for decorator_expr in newnode.decorators.nodes: - if isinstance(decorator_expr, new.Name) and \ - decorator_expr.name in ('classmethod', 'staticmethod'): - newnode.type = decorator_expr.name + if isinstance(decorator_expr, new.Name): + if decorator_expr.name in ('classmethod', 'staticmethod'): + newnode.type = decorator_expr.name + elif decorator_expr.name == 'classproperty': + newnode.type = 'classmethod' frame.set_local(newnode.name, newnode) return newnode |