summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-10-24 01:13:44 +0200
committerAraq <rumpf_a@web.de>2012-10-24 01:13:44 +0200
commitde338526ecaaf86072b7d7c8053db3815238bc1c (patch)
treea1dcfbfff5c9bbb308e7e7326000c27388340ea0 /compiler
parentb1c44c9ae12f14162dcff060d786fd478349bf94 (diff)
downloadNim-de338526ecaaf86072b7d7c8053db3815238bc1c.tar.gz
caas barely works now
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/msgs.nim15
-rwxr-xr-xcompiler/sem.nim6
-rwxr-xr-xcompiler/sigmatch.nim2
3 files changed, 16 insertions, 7 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 0d9a05240..50d7e2904 100755
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -413,6 +413,7 @@ type
     fileIndex*: int32
     
   ERecoverableError* = object of EInvalidValue
+  ESuggestDone* = object of EBase
 
 var
   filenameToIndexTbl = initTable[string, int32]()
@@ -471,11 +472,15 @@ var
 proc SuggestWriteln*(s: string) = 
   if gSilence == 0: 
     if isNil(stdoutSocket): Writeln(stdout, s)
-    else: stdoutSocket.send(s & "\c\L")
+    else: 
+      Writeln(stdout, s)
+      stdoutSocket.send(s & "\c\L")
     
 proc SuggestQuit*() =
   if isNil(stdoutSocket): quit(0)
-  else: stdoutSocket.send("\c\L")
+  else: 
+    stdoutSocket.send("\c\L")
+    raise newException(ESuggestDone, "suggest done")
   
 # this format is understood by many text editors: it is the same that
 # Borland and Freepascal use
@@ -599,8 +604,10 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) =
     maybeTrace()
     inc(gErrorCounter)
     options.gExitcode = 1'i8
-    if gErrorCounter >= gErrorMax or eh == doAbort: 
-      quit(1)                        # one error stops the compiler
+    if gErrorCounter >= gErrorMax: 
+      quit(1)
+    elif eh == doAbort and gCmd != cmdIdeTools:
+      quit(1)
     elif eh == doRaise:
       raiseRecoverableError(s)
 
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 9289df61c..6495177a5 100755
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -259,12 +259,12 @@ proc myProcess(context: PPassContext, n: PNode): PNode =
     let oldInGenericInst = c.InGenericInst
     try:
       result = SemStmtAndGenerateGenerics(c, n)
-    except ERecoverableError:
+    except ERecoverableError, ESuggestDone:
       RecoverContext(c)
       c.InGenericInst = oldInGenericInst
-      result = ast.emptyNode
       msgs.setInfoContextLen(oldContextLen)
-      if gCmd == cmdIdeTools: findSuggest(c, n)
+      result = ast.emptyNode
+      #if gCmd == cmdIdeTools: findSuggest(c, n)
   
 proc checkThreads(c: PContext) =
   if not needsGlobalAnalysis(): return
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index a9753f97d..3205866d1 100755
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -579,6 +579,8 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
 
 proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, 
                     arg: PNode): PNode = 
+  # arg.typ can be nil in 'suggest':
+  if isNil(arg.typ): return nil
   var call = newNodeI(nkCall, arg.info)
   call.add(f.n.copyTree)
   call.add(arg.copyTree)