diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2013-12-16 20:26:24 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2013-12-16 20:26:24 +0200 |
commit | b9254514cbaac0cbd2cec8d1d4070d30b7a84dac (patch) | |
tree | 16141689cf56c339cb2abd2a0c184ab3235ac42c /rebuilder.py | |
parent | baf53b84cdaf74ed279ab5af38087ebb0faa161d (diff) | |
download | astroid-git-b9254514cbaac0cbd2cec8d1d4070d30b7a84dac.tar.gz |
Add support for ast NameConstant, added in Python 3.4.
--HG--
branch : nameconstant_py34
Diffstat (limited to 'rebuilder.py')
-rw-r--r-- | rebuilder.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rebuilder.py b/rebuilder.py index 7f4c7a71..9f1f638d 100644 --- a/rebuilder.py +++ b/rebuilder.py @@ -71,7 +71,6 @@ _CMP_OP_CLASSES = {Eq: '==', CONST_NAME_TRANSFORMS = {'None': None, 'True': True, 'False': False} - REDIRECT = {'arguments': 'Arguments', 'Attribute': 'Getattr', 'comprehension': 'Comprehension', @@ -838,6 +837,12 @@ class TreeRebuilder3k(TreeRebuilder): # XXX or we should instead introduce a Arg node in astroid ? return self.visit_assname(node, parent, node.arg) + def visit_nameconstant(self, node, parent): + # in Python 3.4 we have NameConstant for True/False/None + newnode = new.Const(node.value) + _set_infos(node, newnode, parent) + return newnode + def visit_arguments(self, node, parent): newnode = super(TreeRebuilder3k, self).visit_arguments(node, parent) self.asscontext = "Ass" |