summary refs log tree commit diff stats
path: root/compiler/idgen.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/idgen.nim')
-rw-r--r--compiler/idgen.nim59
1 files changed, 0 insertions, 59 deletions
diff --git a/compiler/idgen.nim b/compiler/idgen.nim
deleted file mode 100644
index 7d49e33e3..000000000
--- a/compiler/idgen.nim
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#
-#           The Nim Compiler
-#        (c) Copyright 2012 Andreas Rumpf
-#
-#    See the file "copying.txt", included in this
-#    distribution, for details about the copyright.
-#
-
-## This module contains a simple persistent id generator.
-
-import idents, strutils, options, pathutils
-
-var gFrontEndId*: int
-
-const
-  debugIds* = false
-
-when debugIds:
-  import intsets
-
-  var usedIds = initIntSet()
-
-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)
-
-proc setId*(id: int) {.inline.} =
-  gFrontEndId = max(gFrontEndId, id + 1)
-
-proc idSynchronizationPoint*(idRange: int) =
-  gFrontEndId = (gFrontEndId div idRange + 1) * idRange + 1
-
-proc toGid(conf: ConfigRef; f: AbsoluteFile): string =
-  # we used to use ``f.addFileExt("gid")`` (aka ``$project.gid``), but this
-  # will cause strange bugs if multiple projects are in the same folder, so
-  # we simply use a project independent name:
-  result = options.completeGeneratedFilePath(conf, AbsoluteFile"nim.gid").string
-
-proc saveMaxIds*(conf: ConfigRef; project: AbsoluteFile) =
-  var f = open(toGid(conf, project), fmWrite)
-  f.writeLine($gFrontEndId)
-  f.close()
-
-proc loadMaxIds*(conf: ConfigRef; project: AbsoluteFile) =
-  var f: File
-  if open(f, toGid(conf, project), fmRead):
-    var line = newStringOfCap(20)
-    if f.readLine(line):
-      var frontEndId = parseInt(line)
-      if f.readLine(line):
-        # var backEndId = parseInt(line)
-        gFrontEndId = max(gFrontEndId, frontEndId)
-    f.close()