[Python-checkins] CVS: python/dist/src/Tools/compiler/compiler misc.py,1.9,1.10

Jeremy Hylton jhylton@users.sourceforge.net
Mon, 17 Sep 2001 11:02:24 -0700


Update of /cvsroot/python/python/dist/src/Tools/compiler/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv2785

Modified Files:
	misc.py 
Log Message:
Add utility to set filename attribute on all nodes


Index: misc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compiler/misc.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** misc.py	2001/08/29 22:26:35	1.9
--- misc.py	2001/09/17 18:02:21	1.10
***************
*** 65,66 ****
--- 65,75 ----
  
      return "_%s%s" % (klass, name)
+ 
+ def set_filename(filename, tree):
+     """Set the filename attribute to filename on every node in tree"""
+     worklist = [tree]
+     while worklist:
+         node = worklist.pop(0)
+         node.filename = filename
+         worklist.extend(node.getChildNodes())
+