summary refs log tree commit diff stats
path: root/compiler/semdata.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semdata.nim')
-rw-r--r--compiler/semdata.nim12
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 41979fd1c..4c94d0812 100644
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -44,13 +44,6 @@ type
     efLValue, efWantIterator, efInTypeof, efWantStmt, efDetermineType,
     efAllowDestructor
   TExprFlags* = set[TExprFlag]
-    
-  TScope* = object
-    depthLevel*: int
-    symbols*: TStrTable
-    parent*: PScope
-
-  PScope* = ref TScope
 
   PContext* = ref TContext
   TContext* = object of TPassContext # a context represents a module
@@ -58,7 +51,6 @@ type
     currentScope*: PScope      # current scope
     importTable*: PScope       # scope for all imported symbols
     topLevelScope*: PScope     # scope for all top-level symbols
-    scopeDepth*: int           # number of open scopes
     p*: PProcCon               # procedure context
     friendModule*: PSym        # current friend module; may access private data;
                                # this is used so that generic instantiations
@@ -112,6 +104,10 @@ proc makeVarType*(c: PContext, baseType: PType): PType
 proc newTypeS*(kind: TTypeKind, c: PContext): PType
 proc fillTypeS*(dest: PType, kind: TTypeKind, c: PContext)
 
+proc scopeDepth*(c: PContext): int {.inline.} =
+  result = if c.currentScope != nil: c.currentScope.depthLevel
+           else: 0
+
 # owner handling:
 proc getCurrOwner*(): PSym
 proc PushOwner*(owner: PSym)