Mercurial > projects > dil
diff trunk/src/dil/semantic/Module.d @ 719:8f8c9ab3f3ba
Fixed code that finds out a modules FQN.
Fixed creation of importPaths in ImportGraph.execute().
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 01 Feb 2008 15:05:26 +0100 |
parents | 1564e41f454e |
children | 90668b83ae5e |
line wrap: on
line diff
--- 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"); } }