summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-05-05 00:42:16 +0300
committerZahary Karadjov <zahary@gmail.com>2013-05-05 00:42:16 +0300
commit5a2720e99075166d2192fd40927f695f58124028 (patch)
tree21c11e40a16a5aa0c625a84fdf031440fa845dca
parent519d5b834ad9601c487b4cc183f80b713e2da53f (diff)
downloadNim-5a2720e99075166d2192fd40927f695f58124028.tar.gz
bugfix: compiling after idetools usage is now possible in caas mode
-rw-r--r--compiler/main.nim10
-rw-r--r--tests/caas/def-def-compile.txt10
2 files changed, 20 insertions, 0 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 6e3b1a352..dde18825e 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -214,6 +214,9 @@ proc rodPass =
   if optSymbolFiles in gGlobalOptions:
     registerPass(rodwritePass)
 
+proc codegenPass =
+  registerPass cgenPass
+
 proc semanticPasses =
   registerPass verbosePass
   registerPass semPass
@@ -381,6 +384,13 @@ proc CommandSuggest =
   msgs.gErrorMax = high(int)  # do not stop after first error
   semanticPasses()
   rodPass()
+  if isServing:
+    # XXX: hacky work-around ahead
+    # Currently, it's possible to issue a idetools command, before
+    # issuing the first compile command. This will leave the compiler
+    # cache in a state where "no recompilation is necessary", but the
+    # cgen pass was never executed at all.
+    codegenPass()
   compileProject()
   if isServing:
     if optDef in gGlobalOptions:
diff --git a/tests/caas/def-def-compile.txt b/tests/caas/def-def-compile.txt
new file mode 100644
index 000000000..64002aff1
--- /dev/null
+++ b/tests/caas/def-def-compile.txt
@@ -0,0 +1,10 @@
+main.nim
+> idetools --track:main.nim,5,18 --def main.nim
+strutils.toUpper
+SuccessX
+> idetools --track:main.nim,5,18 --def main.nim
+strutils.toUpper
+SuccessX
+> c
+SuccessX
+