# # # The Nim Compiler # (c) Copyright 2012 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. # # This module implements a dependency file generator. import options, ast, ropes, idents, passes, modulepaths, pathutils from modulegraphs import ModuleGraph, PPassContext type TGen = object of PPassContext module: PSym config: ConfigRef graph: ModuleGraph PGen = ref TGen Backend = ref object of RootRef dotGraph: Rope proc addDependencyAux(b: Backend; importing, imported: string) = b.dotGraph.addf("\"$1\" -> \"$2\";$n", [rope(importing), rope(imported)]) # s1 -> s2_4[label="[0-9]"]; proc addDotDependency(c: PPassContext, n: PNode): PNode = result = n let g = PGen(c) let b = Backend(g.graph.backend) case n.kind of nkImportStmt: for i in 0..