improvements for idetools; system.compiles improved
This commit is contained in:
parent
48e95fe9f9
commit
087b8621d3
7 changed files with 101 additions and 32 deletions
|
|
@ -78,11 +78,41 @@ type
|
|||
var
|
||||
gGenericsCache: PGenericsCache # save for modularity
|
||||
|
||||
proc newGenericsCache: PGenericsCache =
|
||||
proc newGenericsCache*(): PGenericsCache =
|
||||
new(result)
|
||||
initIdTable(result.InstTypes)
|
||||
result.generics = @[]
|
||||
|
||||
proc tempContext*(c: PContext): PContext =
|
||||
## generates a temporary context so that side-effects can be rolled-back;
|
||||
## necessary for ``system.compiles``.
|
||||
new(result)
|
||||
result.module = c.module
|
||||
result.p = c.p
|
||||
# don't use the old cache:
|
||||
result.generics = newGenericsCache()
|
||||
result.friendModule = c.friendModule
|
||||
result.InstCounter = c.InstCounter
|
||||
result.threadEntries = @[]
|
||||
# hrm, 'tab' is expensive to copy ... so we don't. We open a new scope
|
||||
# instead to be able to undo scope changes. Not entirely correct for
|
||||
# explicit 'global' vars though:
|
||||
#shallowCopy(result.tab, c.tab)
|
||||
assign(result.AmbiguousSymbols, c.AmbiguousSymbols)
|
||||
result.InGenericContext = c.InGenericContext
|
||||
result.InUnrolledContext = c.InUnrolledContext
|
||||
result.InCompilesContext = c.InCompilesContext
|
||||
result.converters = c.converters
|
||||
result.semConstExpr = c.semConstExpr
|
||||
result.semExpr = c.semExpr
|
||||
result.semConstBoolExpr = c.semConstBoolExpr
|
||||
assign(result.includedFiles, c.includedFiles)
|
||||
result.filename = c.filename
|
||||
#shallowCopy(result.userPragmas, c.userPragmas)
|
||||
# XXX mark it as read-only:
|
||||
result.evalContext = c.evalContext
|
||||
|
||||
|
||||
proc newContext*(module: PSym, nimfile: string): PContext
|
||||
|
||||
proc lastOptionEntry*(c: PContext): POptionEntry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue