cas improvements
This commit is contained in:
parent
0ca559b40d
commit
7e31134ff6
3 changed files with 11 additions and 5 deletions
|
|
@ -102,11 +102,14 @@ proc closePasses(a: var TPassContextArray) =
|
||||||
if not isNil(gPasses[i].close): m = gPasses[i].close(a[i], m)
|
if not isNil(gPasses[i].close): m = gPasses[i].close(a[i], m)
|
||||||
a[i] = nil # free the memory here
|
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
|
# this implements the code transformation pipeline
|
||||||
var m = n
|
var m = n
|
||||||
for i in countup(0, gPassesLen - 1):
|
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) =
|
proc processTopLevelStmtCached(n: PNode, a: var TPassContextArray) =
|
||||||
# this implements the code transformation pipeline
|
# this implements the code transformation pipeline
|
||||||
|
|
@ -128,7 +131,7 @@ proc processImplicits(implicits: seq[string], nodeKind: TNodeKind,
|
||||||
var str = newStrNode(nkStrLit, module)
|
var str = newStrNode(nkStrLit, module)
|
||||||
str.info = gCmdLineInfo
|
str.info = gCmdLineInfo
|
||||||
importStmt.addSon str
|
importStmt.addSon str
|
||||||
processTopLevelStmt importStmt, a
|
if not processTopLevelStmt(importStmt, a): break
|
||||||
|
|
||||||
proc processModule(module: PSym, filename: string, stream: PLLStream,
|
proc processModule(module: PSym, filename: string, stream: PLLStream,
|
||||||
rd: PRodReader) =
|
rd: PRodReader) =
|
||||||
|
|
@ -159,7 +162,7 @@ proc processModule(module: PSym, filename: string, stream: PLLStream,
|
||||||
while true:
|
while true:
|
||||||
var n = parseTopLevelStmt(p)
|
var n = parseTopLevelStmt(p)
|
||||||
if n.kind == nkEmpty: break
|
if n.kind == nkEmpty: break
|
||||||
processTopLevelStmt(n, a)
|
if not processTopLevelStmt(n, a): break
|
||||||
|
|
||||||
closeParsers(p)
|
closeParsers(p)
|
||||||
if s.kind != llsStdIn: break
|
if s.kind != llsStdIn: break
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,8 @@ proc myProcess(context: PPassContext, n: PNode): PNode =
|
||||||
RecoverContext(c)
|
RecoverContext(c)
|
||||||
c.InGenericInst = oldInGenericInst
|
c.InGenericInst = oldInGenericInst
|
||||||
msgs.setInfoContextLen(oldContextLen)
|
msgs.setInfoContextLen(oldContextLen)
|
||||||
result = ast.emptyNode
|
if getCurrentException() of ESuggestDone: result = nil
|
||||||
|
else: result = ast.emptyNode
|
||||||
#if gCmd == cmdIdeTools: findSuggest(c, n)
|
#if gCmd == cmdIdeTools: findSuggest(c, n)
|
||||||
|
|
||||||
proc checkThreads(c: PContext) =
|
proc checkThreads(c: PContext) =
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ const
|
||||||
sectionContext = "con"
|
sectionContext = "con"
|
||||||
sectionUsage = "use"
|
sectionUsage = "use"
|
||||||
|
|
||||||
|
#template sectionSuggest(): expr = "##begin\n" & getStackTrace() & "##end\n"
|
||||||
|
|
||||||
proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string =
|
proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string =
|
||||||
result = section
|
result = section
|
||||||
result.add(sep)
|
result.add(sep)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue