summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2015-05-17 16:10:46 +0200
committerdef <dennis@felsin9.de>2015-05-17 16:10:46 +0200
commit2613110015d52ffdcb6ecfd6f7dbb3369016c252 (patch)
tree37f30c01080d11817dc142f2cdc837f3d34e24e4 /compiler
parentdef61c9fcd618ef9a58dd4671978bff7ceaf601a (diff)
downloadNim-2613110015d52ffdcb6ecfd6f7dbb3369016c252.tar.gz
Use gProjectIsStdin instead
Diffstat (limited to 'compiler')
-rw-r--r--compiler/modules.nim2
-rw-r--r--compiler/nim.nim1
-rw-r--r--compiler/options.nim1
3 files changed, 3 insertions, 1 deletions
diff --git a/compiler/modules.nim b/compiler/modules.nim
index 0371f34f3..2fa46f356 100644
--- a/compiler/modules.nim
+++ b/compiler/modules.nim
@@ -148,7 +148,7 @@ proc compileModule*(fileIdx: int32, flags: TSymFlags): PSym =
         return
     else:
       result.id = getID()
-    if sfMainModule in flags and gProjectName == "-":
+    if sfMainModule in flags and gProjectIsStdin:
       processModule(result, llStreamOpen(stdin), rd)
     else:
       processModule(result, nil, rd)
diff --git a/compiler/nim.nim b/compiler/nim.nim
index f04c616fc..89db22e8f 100644
--- a/compiler/nim.nim
+++ b/compiler/nim.nim
@@ -42,6 +42,7 @@ proc handleCmdLine() =
       gProjectName = "stdinfile"
       gProjectFull = "stdinfile"
       gProjectPath = getCurrentDir()
+      gProjectIsStdin = true
     elif gProjectName != "":
       try:
         gProjectFull = canonicalizePath(gProjectName)
diff --git a/compiler/options.nim b/compiler/options.nim
index d07342fce..b3060a180 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -149,6 +149,7 @@ var
   gProjectName* = "" # holds a name like 'nimrod'
   gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/
   gProjectFull* = "" # projectPath/projectName
+  gProjectIsStdin* = false # whether we're compiling from stdin
   gProjectMainIdx*: int32 # the canonical path id of the main module
   nimcacheDir* = ""
   command* = "" # the main command (e.g. cc, check, scan, etc)