merged the persistent scopes work with the delayed proc compilation strategy

This commit is contained in:
Zahary Karadjov 2013-05-12 14:41:32 +03:00
commit 14b5d5f262
12 changed files with 93 additions and 42 deletions

View file

@ -280,6 +280,9 @@ const
sfHoist* = sfVolatile ## proc return value can be hoisted
sfNoForward* = sfRegister
# forward declarations are not required (per module)
const
# getting ready for the future expr/stmt merge
nkWhen* = nkWhenStmt
@ -604,7 +607,14 @@ type
# simple ref count here
PInstantiation* = ref TInstantiation
TScope* = object
depthLevel*: int
symbols*: TStrTable
parent*: PScope
PScope* = ref TScope
PLib* = ref TLib
TSym* {.acyclic.} = object of TIdObj
# proc and type instantiations are cached in the generic symbol
@ -613,12 +623,14 @@ type
typeInstCache*: seq[PType]
of routineKinds:
procInstCache*: seq[PInstantiation]
scope*: PScope # the scope where the proc was defined
of skModule:
# modules keep track of the generic symbols they use from other modules.
# this is because in incremental compilation, when a module is about to
# be replaced with a newer version, we must decrement the usage count
# of all previously used generics.
usedGenerics*: seq[PInstantiation]
tab*: TStrTable # interface table for modules
else: nil
magic*: TMagic
@ -627,7 +639,6 @@ type
info*: TLineInfo
owner*: PSym
flags*: TSymFlags
tab*: TStrTable # interface table for modules
ast*: PNode # syntax tree of proc, iterator, etc.:
# the whole proc including header; this is used
# for easy generation of proper error messages
@ -1049,7 +1060,8 @@ proc copySym(s: PSym, keepId: bool = false): PSym =
when debugIds: RegisterId(result)
result.flags = s.flags
result.magic = s.magic
copyStrTable(result.tab, s.tab)
if s.kind == skModule:
copyStrTable(result.tab, s.tab)
result.options = s.options
result.position = s.position
result.loc = s.loc