caas barely works now

This commit is contained in:
Araq 2012-10-24 01:13:44 +02:00
commit de338526ec
4 changed files with 18 additions and 8 deletions

View file

@ -413,6 +413,7 @@ type
fileIndex*: int32 fileIndex*: int32
ERecoverableError* = object of EInvalidValue ERecoverableError* = object of EInvalidValue
ESuggestDone* = object of EBase
var var
filenameToIndexTbl = initTable[string, int32]() filenameToIndexTbl = initTable[string, int32]()
@ -471,11 +472,15 @@ var
proc SuggestWriteln*(s: string) = proc SuggestWriteln*(s: string) =
if gSilence == 0: if gSilence == 0:
if isNil(stdoutSocket): Writeln(stdout, s) if isNil(stdoutSocket): Writeln(stdout, s)
else: stdoutSocket.send(s & "\c\L") else:
Writeln(stdout, s)
stdoutSocket.send(s & "\c\L")
proc SuggestQuit*() = proc SuggestQuit*() =
if isNil(stdoutSocket): quit(0) 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 # this format is understood by many text editors: it is the same that
# Borland and Freepascal use # Borland and Freepascal use
@ -599,8 +604,10 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) =
maybeTrace() maybeTrace()
inc(gErrorCounter) inc(gErrorCounter)
options.gExitcode = 1'i8 options.gExitcode = 1'i8
if gErrorCounter >= gErrorMax or eh == doAbort: if gErrorCounter >= gErrorMax:
quit(1) # one error stops the compiler quit(1)
elif eh == doAbort and gCmd != cmdIdeTools:
quit(1)
elif eh == doRaise: elif eh == doRaise:
raiseRecoverableError(s) raiseRecoverableError(s)

View file

@ -259,12 +259,12 @@ proc myProcess(context: PPassContext, n: PNode): PNode =
let oldInGenericInst = c.InGenericInst let oldInGenericInst = c.InGenericInst
try: try:
result = SemStmtAndGenerateGenerics(c, n) result = SemStmtAndGenerateGenerics(c, n)
except ERecoverableError: except ERecoverableError, ESuggestDone:
RecoverContext(c) RecoverContext(c)
c.InGenericInst = oldInGenericInst c.InGenericInst = oldInGenericInst
result = ast.emptyNode
msgs.setInfoContextLen(oldContextLen) msgs.setInfoContextLen(oldContextLen)
if gCmd == cmdIdeTools: findSuggest(c, n) result = ast.emptyNode
#if gCmd == cmdIdeTools: findSuggest(c, n)
proc checkThreads(c: PContext) = proc checkThreads(c: PContext) =
if not needsGlobalAnalysis(): return if not needsGlobalAnalysis(): return

View file

@ -579,6 +579,8 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType,
arg: PNode): PNode = arg: PNode): PNode =
# arg.typ can be nil in 'suggest':
if isNil(arg.typ): return nil
var call = newNodeI(nkCall, arg.info) var call = newNodeI(nkCall, arg.info)
call.add(f.n.copyTree) call.add(f.n.copyTree)
call.add(arg.copyTree) call.add(arg.copyTree)

View file

@ -206,7 +206,8 @@ proc raiseExceptionAux(e: ref E_Base) =
else: else:
when hasSomeStackTrace: when hasSomeStackTrace:
var buf = newStringOfCap(2000) var buf = newStringOfCap(2000)
rawWriteStackTrace(buf) if isNil(e.trace): rawWriteStackTrace(buf)
else: add(buf, e.trace)
add(buf, "Error: unhandled exception: ") add(buf, "Error: unhandled exception: ")
if not isNil(e.msg): add(buf, e.msg) if not isNil(e.msg): add(buf, e.msg)
add(buf, " [") add(buf, " [")