summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/ast.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-03-19 17:56:01 (GMT)
committerGuido van Rossum <guido@python.org>2007-03-19 17:56:01 (GMT)
commitd16e81aabe5448a90640694d57cdaefddf3a1a9f (patch)
tree1d422ec1ee0944f60ceedd91f69af4034cb170e6 /Lib/compiler/ast.py
parent801dd736531f7d6db57a1dab80fe6daa37e0a0b0 (diff)
downloadcpython-d16e81aabe5448a90640694d57cdaefddf3a1a9f.zip
cpython-d16e81aabe5448a90640694d57cdaefddf3a1a9f.tar.gz
cpython-d16e81aabe5448a90640694d57cdaefddf3a1a9f.tar.bz2
Fix the compiler package w.r.t. the new metaclass syntax.
(It is still broken w.r.t. the new nonlocal keyword.) Remove a series of debug prints I accidentally left in test_ast.py.
Diffstat (limited to 'Lib/compiler/ast.py')
-rw-r--r--Lib/compiler/ast.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/Lib/compiler/ast.py b/Lib/compiler/ast.py
index 4794d66..fb9be2a 100644
--- a/Lib/compiler/ast.py
+++ b/Lib/compiler/ast.py
@@ -311,9 +311,12 @@ class CallFunc(Node):
return "CallFunc(%s, %s, %s, %s)" % (repr(self.node), repr(self.args), repr(self.star_args), repr(self.dstar_args))
class Class(Node):
- def __init__(self, name, bases, doc, code, lineno=None):
+ def __init__(self, name, args, star_args, dstar_args,
+ doc, code, lineno=None):
self.name = name
- self.bases = bases
+ self.args = args
+ self.star_args = star_args
+ self.dstar_args = dstar_args
self.doc = doc
self.code = code
self.lineno = lineno
@@ -321,19 +324,30 @@ class Class(Node):
def getChildren(self):
children = []
children.append(self.name)
- children.extend(flatten(self.bases))
+ children.extend(flatten(self.args))
+ children.extend(self.star_args)
+ children.extend(self.dstar_args)
children.append(self.doc)
children.append(self.code)
return tuple(children)
def getChildNodes(self):
nodelist = []
- nodelist.extend(flatten_nodes(self.bases))
+ nodelist.extend(flatten_nodes(self.args))
+ if self.star_args is not None:
+ nodelist.append(self.star_args)
+ if self.dstar_args is not None:
+ nodelist.append(self.dstar_args)
nodelist.append(self.code)
return tuple(nodelist)
def __repr__(self):
- return "Class(%s, %s, %s, %s)" % (repr(self.name), repr(self.bases), repr(self.doc), repr(self.code))
+ return "Class(%r, %r, %r, %r, %r, %r)" % (self.name,
+ self.args,
+ self.star_args,
+ self.dstar_args,
+ self.doc,
+ self.code)
class Compare(Node):
def __init__(self, expr, ops, lineno=None):