diff options
Diffstat (limited to 'Tools/compiler')
-rw-r--r-- | Tools/compiler/compiler/misc.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Tools/compiler/compiler/misc.py b/Tools/compiler/compiler/misc.py index 9cbd73f..b4bbe78 100644 --- a/Tools/compiler/compiler/misc.py +++ b/Tools/compiler/compiler/misc.py @@ -64,3 +64,12 @@ def mangle(name, klass): klass = klass[:MANGLE_LEN-tlen] 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()) + |