diff options
author | Araq <rumpf_a@web.de> | 2011-11-27 19:01:55 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-11-27 19:01:55 +0100 |
commit | a489161b1629b2b7347521c8ec67a0e5e812ef6a (patch) | |
tree | eea6b32a8b598a613cdda006c9cbcfcedba7dccf /compiler/idgen.nim | |
parent | 7832af187afa60fee37ab6e598f822b6a6ba6025 (diff) | |
download | Nim-a489161b1629b2b7347521c8ec67a0e5e812ef6a.tar.gz |
compiler uses new 'readLine'
Diffstat (limited to 'compiler/idgen.nim')
-rw-r--r-- | compiler/idgen.nim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/idgen.nim b/compiler/idgen.nim index b6d292574..0a0920c81 100644 --- a/compiler/idgen.nim +++ b/compiler/idgen.nim @@ -23,7 +23,7 @@ when debugIds: proc registerID*(id: PIdObj) = when debugIDs: - if (id.id == - 1) or ContainsOrIncl(usedIds, id.id): + if id.id == -1 or ContainsOrIncl(usedIds, id.id): InternalError("ID already used: " & $id.id) proc getID*(): int {.inline.} = @@ -55,9 +55,12 @@ proc saveMaxIds*(project: string) = proc loadMaxIds*(project: string) = var f: TFile if open(f, project.toGid, fmRead): - var frontEndId = parseInt(f.readLine) - var backEndId = parseInt(f.readLine) - gFrontEndId = max(gFrontEndId, frontEndId) - gBackEndId = max(gBackEndId, backEndId) + var line = newStringOfCap(20) + if f.readLine(line): + var frontEndId = parseInt(line) + if f.readLine(line): + var backEndId = parseInt(line) + gFrontEndId = max(gFrontEndId, frontEndId) + gBackEndId = max(gBackEndId, backEndId) f.close() |