summary refs log tree commit diff stats
path: root/compiler/modules.nim
diff options
context:
space:
mode:
authorrku <rokups@zoho.com>2015-08-20 17:54:55 +0300
committerrku <rokups@zoho.com>2015-08-20 17:54:55 +0300
commit24ad2cb39247039c50db1b0a8633d00130814fda (patch)
tree73c821c1c4e1d5b8a80cccb7324fa77aca191cb2 /compiler/modules.nim
parent6a7a44bbf248fad96ed0eed115e3b3c77a77bf89 (diff)
parent69b32637b1f12000b64fa4db452323dc30b3567f (diff)
downloadNim-24ad2cb39247039c50db1b0a8633d00130814fda.tar.gz
Merge branch 'devel' into coroutines
Diffstat (limited to 'compiler/modules.nim')
-rw-r--r--compiler/modules.nim20
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/modules.nim b/compiler/modules.nim
index 2d0267c93..ad68e6315 100644
--- a/compiler/modules.nim
+++ b/compiler/modules.nim
@@ -85,6 +85,15 @@ proc resetAllModules* =
   resetPackageCache()
   # for m in cgenModules(): echo "CGEN MODULE FOUND"
 
+proc resetAllModulesHard* =
+  resetPackageCache()
+  gCompiledModules.setLen 0
+  gMemCacheData.setLen 0
+  magicsys.resetSysTypes()
+  # XXX
+  #gOwners = @[]
+  #rangeDestructorProc = nil
+
 proc checkDepMem(fileIdx: int32): TNeedRecompile =
   template markDirty =
     resetModule(fileIdx)
@@ -205,9 +214,8 @@ proc compileProject*(projectFileIdx = -1'i32) =
     compileSystemModule()
     discard compileModule(projectFile, {sfMainModule})
 
-var stdinModule: PSym
-proc makeStdinModule*(): PSym =
-  if stdinModule == nil:
-    stdinModule = newModule(fileInfoIdx"stdin")
-    stdinModule.id = getID()
-  result = stdinModule
+proc makeModule*(filename: string): PSym =
+  result = newModule(fileInfoIdx filename)
+  result.id = getID()
+
+proc makeStdinModule*(): PSym = makeModule"stdin"