# HG changeset patch # User Aziz K?ksal # Date 1201874726 -3600 # Node ID 8f8c9ab3f3baddf1d93652471b57852cdc640336 # Parent be887ada3e3e65abf2f1e6d7b455e27e93c7cc94 Fixed code that finds out a modules FQN. Fixed creation of importPaths in ImportGraph.execute(). diff -r be887ada3e3e -r 8f8c9ab3f3ba trunk/src/cmd/ImportGraph.d --- a/trunk/src/cmd/ImportGraph.d Fri Feb 01 14:16:50 2008 +0100 +++ b/trunk/src/cmd/ImportGraph.d Fri Feb 01 15:05:26 2008 +0100 @@ -233,11 +233,9 @@ // Add directory of file and global directories to import paths. auto filePath = new FilePath(filePathString); auto fileDir = filePath.folder(); - if (fileDir.length) - importPaths ~= fileDir; + importPaths ~= fileDir; importPaths ~= GlobalSettings.importPaths; - auto gbuilder = new GraphBuilder; gbuilder.importPaths = importPaths; diff -r be887ada3e3e -r 8f8c9ab3f3ba trunk/src/dil/semantic/Module.d --- a/trunk/src/dil/semantic/Module.d Fri Feb 01 14:16:50 2008 +0100 +++ b/trunk/src/dil/semantic/Module.d Fri Feb 01 15:05:26 2008 +0100 @@ -52,28 +52,24 @@ this.parser = new Parser(loadFile(filePath), filePath, infoMan); this.root = parser.start(); + this.imports = parser.imports; if (root.children.length) { // moduleDecl will be null if first node isn't a ModuleDeclaration. this.moduleDecl = root.children[0].Is!(ModuleDeclaration); - if (moduleDecl) - { + if (this.moduleDecl) this.setFQN(moduleDecl.getFQN()); - } + } + + if (!this.moduleFQN.length) + { + // Take base name of file path as module name. + auto str = (new FilePath(filePath)).name(); + if (!Lexer.isReservedIdentifier(str)) + this.moduleFQN = this.moduleName = str; else - { - // Take base name of file path as module name. - auto str = (new FilePath(filePath)).name(); - if (!Lexer.isReservedIdentifier(str)) - { - this.moduleFQN = moduleName = str; - } - // else - // TODO: error: file name has invalid identifier characters. - } - - this.imports = parser.imports; + throw new Exception("'"~str~"' is not a valid module name"); } }