# HG changeset patch # User Aziz K?ksal # Date 1203545636 -3600 # Node ID edd217e1473616894a40f5886044dd4107d14bbb # Parent 8e6fed11bb68f903db1552ebea6c526b9ca07073 Using CompilationContext in command 'igraph'. diff -r 8e6fed11bb68 -r edd217e14736 trunk/src/cmd/ImportGraph.d --- a/trunk/src/cmd/ImportGraph.d Wed Feb 20 22:47:33 2008 +0100 +++ b/trunk/src/cmd/ImportGraph.d Wed Feb 20 23:13:56 2008 +0100 @@ -9,6 +9,7 @@ import dil.semantic.Module; import dil.parser.ImportParser; import dil.SourceText; +import dil.Compilation; import Settings; import common; @@ -227,7 +228,7 @@ } } -void execute(string filePathString, string[] importPaths, string[] strRegexps, +void execute(string filePathString, CompilationContext context, string[] strRegexps, uint levels, string siStyle, string piStyle, IGraphOption options) { // Init regular expressions. @@ -235,15 +236,14 @@ foreach (strRegexp; strRegexps) regexps ~= new RegExp(strRegexp); - // Add directory of file and global directories to import paths. + // Add the directory of the file to the import paths. auto filePath = new FilePath(filePathString); auto fileDir = filePath.folder(); - importPaths ~= fileDir; - importPaths ~= GlobalSettings.importPaths; + context.importPaths ~= fileDir; auto gbuilder = new GraphBuilder; - gbuilder.importPaths = importPaths; + gbuilder.importPaths = context.importPaths; gbuilder.options = options; gbuilder.filterPredicate = (string moduleFQNPath) { foreach (rx; regexps) diff -r 8e6fed11bb68 -r edd217e14736 trunk/src/dil/Compilation.d --- a/trunk/src/dil/Compilation.d Wed Feb 20 22:47:33 2008 +0100 +++ b/trunk/src/dil/Compilation.d Wed Feb 20 23:13:56 2008 +0100 @@ -24,7 +24,7 @@ this.parent = parent; if (parent) { - this.importPaths = parent.importPaths; + this.importPaths = parent.importPaths.dup; this.debugLevel = parent.debugLevel; this.versionLevel = parent.versionLevel; this.releaseBuild = parent.releaseBuild; diff -r 8e6fed11bb68 -r edd217e14736 trunk/src/main.d --- a/trunk/src/main.d Wed Feb 20 22:47:33 2008 +0100 +++ b/trunk/src/main.d Wed Feb 20 23:13:56 2008 +0100 @@ -154,16 +154,18 @@ break; case "importgraph", "igraph": string filePath; - string[] includePaths; string[] regexps; string siStyle = "dashed"; // static import style string piStyle = "bold"; // public import style uint levels; IGraphOption options; + auto context = newCompilationContext(); foreach (arg; args[2..$]) { - if (strbeg(arg, "-I")) - includePaths ~= arg[2..$]; + if (parseDebugOrVersion(arg, context)) + {} + else if (strbeg(arg, "-I")) + context.importPaths ~= arg[2..$]; else if(strbeg(arg, "-r")) regexps ~= arg[2..$]; else if(strbeg(arg, "-l")) @@ -197,7 +199,7 @@ filePath = arg; } } - cmd.ImportGraph.execute(filePath, includePaths, regexps, levels, siStyle, piStyle, options); + cmd.ImportGraph.execute(filePath, context, regexps, levels, siStyle, piStyle, options); break; case "stats", "statistics": char[][] filePaths;