diff options
author | Charles Blake <cblake@csail.mit.edu> | 2015-02-12 06:44:09 -0500 |
---|---|---|
committer | Charles Blake <cblake@csail.mit.edu> | 2015-02-12 06:44:09 -0500 |
commit | 49d88cee68269bf6ed5373777bb76df5c18af495 (patch) | |
tree | 46c2963cdfa0b00e76c1ab967cbc2a6dffcf6b30 /lib/pure/collections/tables.nim | |
parent | 5fbcf93860e68d7ddde4b01aa4b7222a7fcaaabc (diff) | |
download | Nim-49d88cee68269bf6ed5373777bb76df5c18af495.tar.gz |
Oops - missed updates to a few later rawGet()s.
Diffstat (limited to 'lib/pure/collections/tables.nim')
-rw-r--r-- | lib/pure/collections/tables.nim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index da9d21050..4858ca2b5 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -246,7 +246,8 @@ template putImpl() {.dirty.} = when false: # not yet used: template hasKeyOrPutImpl() {.dirty.} = - var index = rawGet(t, key) + var hc: THash + var index = rawGet(t, key, hc) if index >= 0: t.data[index].val = val result = true @@ -490,19 +491,22 @@ proc `[]`*[A, B](t: OrderedTable[A, B], key: A): B = ## default empty value for the type `B` is returned ## and no exception is raised. One can check with ``hasKey`` whether the key ## exists. - var index = rawGet(t, key) + var hc: THash + var index = rawGet(t, key, hc) if index >= 0: result = t.data[index].val proc mget*[A, B](t: var OrderedTable[A, B], key: A): var B = ## retrieves the value at ``t[key]``. The value can be modified. ## If `key` is not in `t`, the ``EInvalidKey`` exception is raised. - var index = rawGet(t, key) + var hc: THash + var index = rawGet(t, key, hc) if index >= 0: result = t.data[index].val else: raise newException(KeyError, "key not found: " & $key) proc hasKey*[A, B](t: OrderedTable[A, B], key: A): bool = ## returns true iff `key` is in the table `t`. - result = rawGet(t, key) >= 0 + var hc: THash + result = rawGet(t, key, hc) >= 0 proc rawInsert[A, B](t: var OrderedTable[A, B], data: var OrderedKeyValuePairSeq[A, B], |