Template replacements acutally propegate through the function now - but it doesn't decorate names so that same named functions with same parameters but instantiated by different types but with the resulting same prototype, so they end up having the same name in C, which needs to be addressed.

This commit is contained in:
Nathan Braswell
2016-02-04 23:32:47 -05:00
parent de3ead0573
commit 5dd8046d2f
3 changed files with 73 additions and 63 deletions

View File

@@ -1041,9 +1041,11 @@ fun ast_to_dot(root: *ast_node): string {
node_name_map.set(node, escaped)
return escaped
}
var done_set = set<*ast_node>()
var helper: fun(*ast_node):void = fun(node: *ast_node) {
done_set.add(node)
get_ast_children(node).for_each(fun(child: *ast_node) {
if (!child)
if (!child || done_set.contains(child))
return; // where on earth does the null come from
ret += string("\"") + get_name(node) + "\" -> \"" + get_name(child) + "\"\n";
helper(child)