summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-01-28 00:26:49 +0200
committerZahary Karadjov <zahary@gmail.com>2013-01-28 00:26:49 +0200
commit19e795e0177889fa1a5898ce0469f79a47a3dd73 (patch)
tree41dde47101deec2a26e4f92698545ef9747b8e75 /compiler
parent81a3585872b1a327b62ba528addbee913d6bbe5a (diff)
downloadNim-19e795e0177889fa1a5898ce0469f79a47a3dd73.tar.gz
the `mainmodule` option has effect only when no explicit module is given
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/commands.nim3
-rwxr-xr-xcompiler/main.nim13
-rwxr-xr-xcompiler/options.nim3
3 files changed, 9 insertions, 10 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index a26626cc4..910a8bca5 100755
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -231,8 +231,7 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
     options.outFile = arg
   of "mainmodule", "m":
     expectArg(switch, arg, pass, info)
-    gProjectName = arg
-    gProjectFull = gProjectPath / gProjectName
+    optMainModule = arg
   of "define", "d": 
     expectArg(switch, arg, pass, info)
     DefineSymbol(arg)
diff --git a/compiler/main.nim b/compiler/main.nim
index cba96a104..ac37ab5f3 100755
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -382,14 +382,13 @@ proc CommandSuggest =
 
 proc wantMainModule =
   if gProjectFull.len == 0:
-    Fatal(gCmdLineInfo, errCommandExpectsFilename)
-  gProjectMainIdx = addFileExt(gProjectFull, nimExt).fileInfoIdx
-
-var oss: PGenericSeq
-proc dbgseqimp(x: PGenericSeq) {.cdecl.} =
-  oss = x
+    if optMainModule.len == 0:
+      Fatal(gCmdLineInfo, errCommandExpectsFilename)
+    else:
+      gProjectName = optMainModule
+      gProjectFull = gProjectPath / gProjectName
 
-seqdbg = dbgseqimp
+  gProjectMainIdx = addFileExt(gProjectFull, nimExt).fileInfoIdx
 
 proc resetMemory =
   resetCompilationLists()
diff --git a/compiler/options.nim b/compiler/options.nim
index 7350f81b7..54ebc5486 100755
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -99,7 +99,7 @@ var
   gVerbosity*: int            # how verbose the compiler is
   gNumberOfProcessors*: int   # number of processors
   gWholeProject*: bool # for 'doc2': output any dependency
-  gEvalExpr*: string          # expression for idetools --eval
+  gEvalExpr* = ""             # expression for idetools --eval
   gLastCmdTime*: float        # when caas is enabled, we measure each command
   gListFullPaths*: bool
   
@@ -124,6 +124,7 @@ var
   gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/
   gProjectFull* = "" # projectPath/projectName
   gProjectMainIdx*: int32 # the canonical path id of the main module
+  optMainModule* = "" # the main module that should be used for idetools commands
   nimcacheDir* = ""
   command* = "" # the main command (e.g. cc, check, scan, etc)
   commandArgs*: seq[string] = @[] # any arguments after the main command