Add utility to set filename attribute on all nodes
This commit is contained in:
parent
b329b7134c
commit
09392b77a4
|
@ -64,3 +64,12 @@ def mangle(name, klass):
|
||||||
klass = klass[:MANGLE_LEN-tlen]
|
klass = klass[:MANGLE_LEN-tlen]
|
||||||
|
|
||||||
return "_%s%s" % (klass, name)
|
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())
|
||||||
|
|
||||||
|
|
|
@ -64,3 +64,12 @@ def mangle(name, klass):
|
||||||
klass = klass[:MANGLE_LEN-tlen]
|
klass = klass[:MANGLE_LEN-tlen]
|
||||||
|
|
||||||
return "_%s%s" % (klass, name)
|
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())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue