summary refs log tree commit diff stats
path: root/compiler/main.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main.nim')
-rwxr-xr-xcompiler/main.nim13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 37feabd17..dec393c50 100755
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -16,7 +16,7 @@ import
   wordrecg, sem, semdata, idents, passes, docgen, extccomp,
   cgen, ecmasgen,
   platform, nimconf, importer, passaux, depends, evals, types, idgen,
-  tables, docgen2
+  tables, docgen2, service
 
 const
   has_LLVM_Backend = false
@@ -292,5 +292,16 @@ proc MainCommand =
     gCmd = cmdIdeTools
     wantMainModule()
     CommandSuggest()
+  of "serve":
+    gCmd = cmdIdeTools
+    msgs.gErrorMax = high(int)  # do not stop after first error
+    semanticPasses()
+    # no need to write rod files and would slow down things:
+    #registerPass(rodwrite.rodwritePass())
+    discard CompileModule(options.libpath / "system", {sfSystemModule})
+    service.serve(proc () =
+      let projectFile = gProjectFull
+      discard CompileModule(projectFile, {sfMainModule})
+    )
   else: rawMessage(errInvalidCommandX, command)