Remove expr/stmt (#5857)

This commit is contained in:
Arne Döring 2017-07-25 09:28:23 +02:00 • committed by Andreas Rumpf
commit 000b8afd26
168 changed files with 497 additions and 529 deletions

View file

@ -143,15 +143,16 @@ proc `[]=`*[T](c: var CritBitTree[T], key: string, val: T) =
var n = rawInsert(c, key)
n.val = val
template get[T](c: CritBitTree[T], key: string): T {.immediate.} =
template get[T](c: CritBitTree[T], key: string): T =
let n = rawGet(c, key)
if n != nil: result = n.val
else:
if n == nil:
when compiles($key):
raise newException(KeyError, "key not found: " & $key)
else:
raise newException(KeyError, "key not found")
n.val
proc `[]`*[T](c: CritBitTree[T], key: string): T {.inline, deprecatedGet.} =
## retrieves the value at ``c[key]``. If `key` is not in `t`, the
## ``KeyError`` exception is raised. One can check with ``hasKey`` whether

View file

@ -189,7 +189,7 @@ iterator items*(s: IntSet): int {.inline.} =
inc(i)
r = r.next
template dollarImpl(): stmt =
template dollarImpl(): untyped =
result = "{"
for key in items(s):
if result.len > 1: result.add(", ")

View file

@ -455,7 +455,7 @@ template anyIt*(seq1, pred: untyped): bool =
break
result
template toSeq*(iter: untyped): untyped {.oldimmediate.} =
template toSeq*(iter: untyped): untyped =
## Transforms any iterator into a sequence.
##
## Example:

View file

@ -25,7 +25,7 @@ type
counter, dataLen: int
lock: Lock
template maxHash(t): expr = t.dataLen-1
template maxHash(t): untyped = t.dataLen-1
include tableimpl

View file

@ -85,7 +85,7 @@ template addImpl(enlarge) {.dirty.} =
rawInsert(t, t.data, key, val, hc, j)
inc(t.counter)
template maybeRehashPutImpl(enlarge) {.oldimmediate, dirty.} =
template maybeRehashPutImpl(enlarge) {.dirty.} =
if mustRehash(t.dataLen, t.counter):
enlarge(t)
index = rawGetKnownHC(t, key, hc)
@ -93,7 +93,7 @@ template maybeRehashPutImpl(enlarge) {.oldimmediate, dirty.} =
rawInsert(t, t.data, key, val, hc, index)
inc(t.counter)
template putImpl(enlarge) {.oldimmediate, dirty.} =
template putImpl(enlarge) {.dirty.} =
var hc: Hash
var index = rawGet(t, key, hc)
if index >= 0: t.data[index].val = val