diff options
Diffstat (limited to 'compiler/idgen.nim')
-rw-r--r-- | compiler/idgen.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/idgen.nim b/compiler/idgen.nim index 6dc19474d..d2e322796 100644 --- a/compiler/idgen.nim +++ b/compiler/idgen.nim @@ -11,7 +11,7 @@ import idents, strutils, os, options -var gFrontEndId, gBackendId*: int +var gFrontEndId, gBackendId*, genSymBaseId*: int const debugIds* = false @@ -25,7 +25,7 @@ proc registerID*(id: PIdObj) = when debugIDs: if id.id == -1 or ContainsOrIncl(usedIds, id.id): InternalError("ID already used: " & $id.id) - + proc getID*(): int {.inline.} = result = gFrontEndId inc(gFrontEndId) @@ -34,6 +34,9 @@ proc backendId*(): int {.inline.} = result = gBackendId inc(gBackendId) +proc genSym*(basename: string): PIdent = + result = getIdent(basename & $genSymBaseId) + proc setId*(id: int) {.inline.} = gFrontEndId = max(gFrontEndId, id + 1) |