Merge branch 'master' of github.com:Araq/Nimrod
This commit is contained in:
commit
635ad3b336
31 changed files with 460 additions and 331 deletions
|
|
@ -130,8 +130,8 @@ proc isTemplParam(c: TemplCtx, n: PNode): bool {.inline.} =
|
|||
|
||||
proc semTemplBody(c: var TemplCtx, n: PNode): PNode
|
||||
|
||||
proc openScope(c: var TemplCtx) = openScope(c.c.tab)
|
||||
proc closeScope(c: var TemplCtx) = closeScope(c.c.tab)
|
||||
proc openScope(c: var TemplCtx) = openScope(c.c)
|
||||
proc closeScope(c: var TemplCtx) = closeScope(c.c)
|
||||
|
||||
proc semTemplBodyScope(c: var TemplCtx, n: PNode): PNode =
|
||||
openScope(c)
|
||||
|
|
@ -379,7 +379,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
|
|||
s = semIdentVis(c, skTemplate, n.sons[0], {})
|
||||
# check parameter list:
|
||||
pushOwner(s)
|
||||
openScope(c.tab)
|
||||
openScope(c)
|
||||
n.sons[namePos] = newSymNode(s, n.sons[namePos].info)
|
||||
if n.sons[pragmasPos].kind != nkEmpty:
|
||||
pragma(c, s, n.sons[pragmasPos], templatePragmas)
|
||||
|
|
@ -422,18 +422,17 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
|
|||
if s.typ.sons[0].kind notin {tyStmt, tyTypeDesc}:
|
||||
n.sons[bodyPos] = transformToExpr(n.sons[bodyPos])
|
||||
# only parameters are resolved, no type checking is performed
|
||||
closeScope(c.tab)
|
||||
closeScope(c)
|
||||
popOwner()
|
||||
s.ast = n
|
||||
result = n
|
||||
if n.sons[bodyPos].kind == nkEmpty:
|
||||
LocalError(n.info, errImplOfXexpected, s.name.s)
|
||||
let curScope = c.tab.tos - 1
|
||||
var proto = SearchForProc(c, s, curScope)
|
||||
var proto = SearchForProc(c, c.currentScope, s)
|
||||
if proto == nil:
|
||||
addInterfaceOverloadableSymAt(c, s, curScope)
|
||||
addInterfaceOverloadableSymAt(c, c.currentScope, s)
|
||||
else:
|
||||
SymTabReplace(c.tab.stack[curScope], proto, s)
|
||||
SymTabReplace(c.currentScope.symbols, proto, s)
|
||||
if n.sons[patternPos].kind != nkEmpty:
|
||||
c.patterns.add(s)
|
||||
|
||||
|
|
@ -551,7 +550,7 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode =
|
|||
result.sons[i] = semPatternBody(c, n.sons[i])
|
||||
|
||||
proc semPattern(c: PContext, n: PNode): PNode =
|
||||
openScope(c.tab)
|
||||
openScope(c)
|
||||
var ctx: TemplCtx
|
||||
ctx.toBind = initIntSet()
|
||||
ctx.toMixin = initIntSet()
|
||||
|
|
@ -563,4 +562,4 @@ proc semPattern(c: PContext, n: PNode): PNode =
|
|||
result = result.sons[0]
|
||||
elif result.len == 0:
|
||||
LocalError(n.info, errInvalidExpression)
|
||||
closeScope(c.tab)
|
||||
closeScope(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue