diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-05-29 22:21:51 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-05-29 22:21:51 +0200 |
commit | 5b27b263fd76484fa6251ccd29520c2764b55818 (patch) | |
tree | 0629164266d4183ace4503d77f0d2a999fc9693f /compiler/astalgo.nim | |
parent | eb471acffb02ebb14ada8483f8c8043a1c8e8210 (diff) | |
download | Nim-5b27b263fd76484fa6251ccd29520c2764b55818.tar.gz |
Remove immediate pragma (#11308)
* remove immediate from tests * remove immediate from the compiler
Diffstat (limited to 'compiler/astalgo.nim')
-rw-r--r-- | compiler/astalgo.nim | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index c1df74a3f..4100c3629 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -667,31 +667,14 @@ proc strTableContains*(t: TStrTable, n: PSym): bool = proc strTableRawInsert(data: var seq[PSym], n: PSym) = var h: Hash = n.name.h and high(data) - if sfImmediate notin n.flags: - # fast path: - while data[h] != nil: - if data[h] == n: - # allowed for 'export' feature: - #InternalError(n.info, "StrTableRawInsert: " & n.name.s) - return - h = nextTry(h, high(data)) - assert(data[h] == nil) - data[h] = n - else: - # slow path; we have to ensure immediate symbols are preferred for - # symbol lookups. - # consider the chain: foo (immediate), foo, bar, bar (immediate) - # then bar (immediate) gets replaced with foo (immediate) and the non - # immediate foo is picked! Thus we need to replace it with the first - # slot that has in fact the same identifier stored in it! - var favPos = -1 - while data[h] != nil: - if data[h] == n: return - if favPos < 0 and data[h].name.id == n.name.id: favPos = h - h = nextTry(h, high(data)) - assert(data[h] == nil) - data[h] = n - if favPos >= 0: swap data[h], data[favPos] + while data[h] != nil: + if data[h] == n: + # allowed for 'export' feature: + #InternalError(n.info, "StrTableRawInsert: " & n.name.s) + return + h = nextTry(h, high(data)) + assert(data[h] == nil) + data[h] = n proc symTabReplaceRaw(data: var seq[PSym], prevSym: PSym, newSym: PSym) = assert prevSym.name.h == newSym.name.h |