summary refs log tree commit diff stats
path: root/compiler/semtempl.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semtempl.nim')
-rw-r--r--compiler/semtempl.nim19
1 files changed, 9 insertions, 10 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index 6b4af2a94..0405ba9d1 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -125,8 +125,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)
@@ -362,7 +362,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)
@@ -404,18 +404,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)
 
@@ -533,7 +532,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.c = c
@@ -544,4 +543,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)