diff --git a/compiler/passes.nim b/compiler/passes.nim index c073047af..9b4a1b365 100755 --- a/compiler/passes.nim +++ b/compiler/passes.nim @@ -102,11 +102,14 @@ proc closePasses(a: var TPassContextArray) = if not isNil(gPasses[i].close): m = gPasses[i].close(a[i], m) a[i] = nil # free the memory here -proc processTopLevelStmt(n: PNode, a: var TPassContextArray) = +proc processTopLevelStmt(n: PNode, a: var TPassContextArray): bool = # this implements the code transformation pipeline var m = n for i in countup(0, gPassesLen - 1): - if not isNil(gPasses[i].process): m = gPasses[i].process(a[i], m) + if not isNil(gPasses[i].process): + m = gPasses[i].process(a[i], m) + if isNil(m): return false + result = true proc processTopLevelStmtCached(n: PNode, a: var TPassContextArray) = # this implements the code transformation pipeline @@ -128,7 +131,7 @@ proc processImplicits(implicits: seq[string], nodeKind: TNodeKind, var str = newStrNode(nkStrLit, module) str.info = gCmdLineInfo importStmt.addSon str - processTopLevelStmt importStmt, a + if not processTopLevelStmt(importStmt, a): break proc processModule(module: PSym, filename: string, stream: PLLStream, rd: PRodReader) = @@ -159,7 +162,7 @@ proc processModule(module: PSym, filename: string, stream: PLLStream, while true: var n = parseTopLevelStmt(p) if n.kind == nkEmpty: break - processTopLevelStmt(n, a) + if not processTopLevelStmt(n, a): break closeParsers(p) if s.kind != llsStdIn: break diff --git a/compiler/sem.nim b/compiler/sem.nim index 6495177a5..21bbdf4d2 100755 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -263,7 +263,8 @@ proc myProcess(context: PPassContext, n: PNode): PNode = RecoverContext(c) c.InGenericInst = oldInGenericInst msgs.setInfoContextLen(oldContextLen) - result = ast.emptyNode + if getCurrentException() of ESuggestDone: result = nil + else: result = ast.emptyNode #if gCmd == cmdIdeTools: findSuggest(c, n) proc checkThreads(c: PContext) = diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 51f250251..404f1c1bb 100755 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -18,6 +18,8 @@ const sectionContext = "con" sectionUsage = "use" +#template sectionSuggest(): expr = "##begin\n" & getStackTrace() & "##end\n" + proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string = result = section result.add(sep)