big compiler refactoring; avoid globals for multi method dispatcher generation

This commit is contained in:
Andreas Rumpf 2017-02-22 16:27:52 +01:00
commit 46efaf294b
29 changed files with 225 additions and 215 deletions

View file

@ -60,7 +60,7 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
# (s.kind notin routineKinds or s.magic != mNone):
# for instance 'nextTry' is both in tables.nim and astalgo.nim ...
result = newSymNode(s, n.info)
markUsed(n.info, s)
markUsed(n.info, s, c.graph.usageSym)
else:
# semantic checking requires a type; ``fitNode`` deals with it
# appropriately
@ -559,7 +559,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
styleCheckDef(s)
# check parameter list:
#s.scope = c.currentScope
pushOwner(s)
pushOwner(c, s)
openScope(c)
n.sons[namePos] = newSymNode(s, n.sons[namePos].info)
if n.sons[pragmasPos].kind != nkEmpty:
@ -613,7 +613,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
# only parameters are resolved, no type checking is performed
semIdeForTemplateOrGeneric(c, n.sons[bodyPos], ctx.cursorInBody)
closeScope(c)
popOwner()
popOwner(c)
s.ast = n
result = n
if n.sons[bodyPos].kind == nkEmpty:
@ -758,7 +758,7 @@ proc semPattern(c: PContext, n: PNode): PNode =
ctx.toMixin = initIntSet()
ctx.toInject = initIntSet()
ctx.c = c
ctx.owner = getCurrOwner()
ctx.owner = getCurrOwner(c)
result = flattenStmts(semPatternBody(ctx, n))
if result.kind in {nkStmtList, nkStmtListExpr}:
if result.len == 1: