Mercurial > projects > dil
changeset 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 | be887ada3e3e |
children | 74cdbb25c7c8 |
files | trunk/src/cmd/ImportGraph.d trunk/src/dil/semantic/Module.d |
diffstat | 2 files changed, 12 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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"); } }