summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorReimer Behrends <behrends@gmail.com>2014-06-25 00:42:55 +0200
committerReimer Behrends <behrends@gmail.com>2014-06-25 00:42:55 +0200
commit55e7d91b317444d874b3ce88c44536842ef0821b (patch)
tree90056c47b6b8fd38566c69416854b6aff3091908 /compiler
parent0449791185042ddb8ad2819d773b3aefbe4a91a6 (diff)
downloadNim-55e7d91b317444d874b3ce88c44536842ef0821b.tar.gz
Fix generation of package-dependent init names.
The code incorrectly used relative instead of absolute paths to
see if *.babel files could be found, which could result in them
not being located properly.

Also added an underscore between the package and the module name
for package_moduleInit() and package_moduleDatInit() so that there
won't be spurious conflicts, e.g. for package A and module BC vs.
package AB and module C.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgen.nim1
-rw-r--r--compiler/modules.nim2
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index a5852c735..e2f3b5ab0 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -1050,6 +1050,7 @@ proc getSomeInitName(m: PSym, suffix: string): PRope =
   assert m.owner.kind == skPackage
   if {sfSystemModule, sfMainModule} * m.flags == {}:
     result = m.owner.name.s.mangle.toRope
+    result.app "_"
   result.app m.name.s
   result.app suffix
   
diff --git a/compiler/modules.nim b/compiler/modules.nim
index fb1940741..b102224cd 100644
--- a/compiler/modules.nim
+++ b/compiler/modules.nim
@@ -115,7 +115,7 @@ proc newModule(fileIdx: int32): PSym =
   new(result)
   result.id = - 1             # for better error checking
   result.kind = skModule
-  let filename = fileIdx.toFilename
+  let filename = fileIdx.toFullPath
   result.name = getIdent(splitFile(filename).name)
   if not isNimrodIdentifier(result.name.s):
     rawMessage(errInvalidModuleName, result.name.s)