Mercurial > projects > dil
comparison trunk/src/cmd/ImportGraph.d @ 780:edd217e14736
Using CompilationContext in command 'igraph'.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 20 Feb 2008 23:13:56 +0100 |
parents | 8e6fed11bb68 |
children | 57ef69eced96 |
comparison
equal
deleted
inserted
replaced
779:8e6fed11bb68 | 780:edd217e14736 |
---|---|
7 import dil.ast.Node; | 7 import dil.ast.Node; |
8 import dil.ast.Declarations; | 8 import dil.ast.Declarations; |
9 import dil.semantic.Module; | 9 import dil.semantic.Module; |
10 import dil.parser.ImportParser; | 10 import dil.parser.ImportParser; |
11 import dil.SourceText; | 11 import dil.SourceText; |
12 import dil.Compilation; | |
12 import Settings; | 13 import Settings; |
13 import common; | 14 import common; |
14 | 15 |
15 import tango.text.Regex : RegExp = Regex; | 16 import tango.text.Regex : RegExp = Regex; |
16 import tango.io.FilePath; | 17 import tango.io.FilePath; |
225 } | 226 } |
226 return vertex; | 227 return vertex; |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
230 void execute(string filePathString, string[] importPaths, string[] strRegexps, | 231 void execute(string filePathString, CompilationContext context, string[] strRegexps, |
231 uint levels, string siStyle, string piStyle, IGraphOption options) | 232 uint levels, string siStyle, string piStyle, IGraphOption options) |
232 { | 233 { |
233 // Init regular expressions. | 234 // Init regular expressions. |
234 RegExp[] regexps; | 235 RegExp[] regexps; |
235 foreach (strRegexp; strRegexps) | 236 foreach (strRegexp; strRegexps) |
236 regexps ~= new RegExp(strRegexp); | 237 regexps ~= new RegExp(strRegexp); |
237 | 238 |
238 // Add directory of file and global directories to import paths. | 239 // Add the directory of the file to the import paths. |
239 auto filePath = new FilePath(filePathString); | 240 auto filePath = new FilePath(filePathString); |
240 auto fileDir = filePath.folder(); | 241 auto fileDir = filePath.folder(); |
241 importPaths ~= fileDir; | 242 context.importPaths ~= fileDir; |
242 importPaths ~= GlobalSettings.importPaths; | |
243 | 243 |
244 auto gbuilder = new GraphBuilder; | 244 auto gbuilder = new GraphBuilder; |
245 | 245 |
246 gbuilder.importPaths = importPaths; | 246 gbuilder.importPaths = context.importPaths; |
247 gbuilder.options = options; | 247 gbuilder.options = options; |
248 gbuilder.filterPredicate = (string moduleFQNPath) { | 248 gbuilder.filterPredicate = (string moduleFQNPath) { |
249 foreach (rx; regexps) | 249 foreach (rx; regexps) |
250 // Replace slashes: dil/ast/Node -> dil.ast.Node | 250 // Replace slashes: dil/ast/Node -> dil.ast.Node |
251 if (rx.test(replace(moduleFQNPath.dup, dirSep, '.'))) | 251 if (rx.test(replace(moduleFQNPath.dup, dirSep, '.'))) |