summary refs log tree commit diff stats
path: root/compiler/main.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main.nim')
-rw-r--r--compiler/main.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 6df21f660..7cfc6d406 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -210,7 +210,11 @@ proc CommandSuggest =
     msgs.gErrorMax = high(int)  # do not stop after first error
     semanticPasses()
     rodPass()
-    compileProject()
+    # XXX: this handles the case when the dirty buffer is the main file,
+    # but doesn't handle the case when it's imported module
+    var projFile = if gProjectMainIdx == gDirtyOriginalIdx: gDirtyBufferIdx
+                   else: gProjectMainIdx
+    compileProject(projFile)
 
 proc wantMainModule =
   if gProjectFull.len == 0: