[pypy-svn] r18011 - in pypy/dist/pypy/interpreter: astcompiler pyparser/test
pedronis at codespeak.net
pedronis at codespeak.net
Fri Sep 30 19:42:00 CEST 2005
Author: pedronis
Date: Fri Sep 30 19:41:58 2005
New Revision: 18011
Modified:
pypy/dist/pypy/interpreter/astcompiler/ast.py
pypy/dist/pypy/interpreter/astcompiler/astgen.py
pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py
Log:
fixing 18001 breakage to test_astbuilder:
- special case Return because now the behavior is different from transformer
- generated getChildren was broken for '&' children :(
Modified: pypy/dist/pypy/interpreter/astcompiler/ast.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/ast.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/ast.py Fri Sep 30 19:41:58 2005
@@ -1477,7 +1477,7 @@
def getChildren(self):
"NOT_RPYTHON"
- return tuple(flatten(self.value))
+ return (self.value,)
def getChildNodes(self):
nodelist = []
Modified: pypy/dist/pypy/interpreter/astcompiler/astgen.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/astgen.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/astgen.py Fri Sep 30 19:41:58 2005
@@ -154,7 +154,11 @@
print >> buf, " return %s" % clist
else:
if len(self.argnames) == 1:
- print >> buf, " return tuple(flatten(self.%s))" % self.argnames[0]
+ name = self.argnames[0]
+ if self.argprops[name] == P_NESTED:
+ print >> buf, " return tuple(flatten(self.%s))" % name
+ else:
+ print >> buf, " return (self.%s,)" % name
else:
print >> buf, " children = []"
template = " children.%s(%sself.%s%s)"
Modified: pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py (original)
+++ pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py Fri Sep 30 19:41:58 2005
@@ -75,6 +75,12 @@
print "(0) (%s) left: %s, right: %s" % (left, left.lineno, right.lineno)
return False
return True
+ elif isinstance(right, ast_ast.Return) and isinstance(left, stable_ast.Return):
+ left_nodes = left.getChildren()
+ if right.value is None:
+ right_nodes = (ast_ast.Const(None),)
+ else:
+ right_nodes = right.getChildren()
else:
left_nodes = left.getChildren()
right_nodes = right.getChildren()
More information about the Pypy-commit
mailing list