summaryrefslogtreecommitdiff
path: root/rebuilder.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2013-12-16 20:26:24 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2013-12-16 20:26:24 +0200
commitb9254514cbaac0cbd2cec8d1d4070d30b7a84dac (patch)
tree16141689cf56c339cb2abd2a0c184ab3235ac42c /rebuilder.py
parentbaf53b84cdaf74ed279ab5af38087ebb0faa161d (diff)
downloadastroid-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.py7
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"