[pypy-svn] r22604 - pypy/branch/ast-experiments/pypy/module/recparser/hooksamples
adim at codespeak.net
adim at codespeak.net
Tue Jan 24 17:28:51 CET 2006
Author: adim
Date: Tue Jan 24 17:28:50 2006
New Revision: 22604
Modified:
pypy/branch/ast-experiments/pypy/module/recparser/hooksamples/tracer.py
Log:
oops, forgot to checkin tracer update
Modified: pypy/branch/ast-experiments/pypy/module/recparser/hooksamples/tracer.py
==============================================================================
--- pypy/branch/ast-experiments/pypy/module/recparser/hooksamples/tracer.py (original)
+++ pypy/branch/ast-experiments/pypy/module/recparser/hooksamples/tracer.py Tue Jan 24 17:28:50 2006
@@ -5,7 +5,7 @@
XXX: crashes on everything else than simple assignment (AssAttr, etc.)
"""
-from parser import ASTPrintnl, ASTConst, ASTName
+from parser import ASTPrintnl, ASTConst, ASTName, ASTAssign
from parser import install_compiler_hook, source2ast
BEFORE_LOG_SOURCE = """if '%s' in locals() or '%s' in globals():
@@ -29,15 +29,18 @@
child.accept(self)
return node
- def visitAssign(self, assign):
+ def visitAssName(self, assname):
+ assign = assname
+ while not isinstance(assign, ASTAssign):
+ assign = assign.parent
stmt = assign.parent
- varname = assign.nodes[0].name
+ varname = assname.name
before_stmts = get_statements(BEFORE_LOG_SOURCE % ((varname,) * 5))
after_stmts = get_statements(AFTER_LOG_SOURCE % (varname, varname))
stmt.insert_before(assign, before_stmts)
stmt.insert_after(assign, after_stmts)
- return assign
-
+ return assname
+
def __getattr__(self, attrname):
if attrname.startswith('visit'):
return self.default
More information about the Pypy-commit
mailing list