diff options
author | Andrii Riabushenko <cdome@bk.ru> | 2018-12-07 22:11:34 +0000 |
---|---|---|
committer | Andrii Riabushenko <cdome@bk.ru> | 2018-12-07 22:11:34 +0000 |
commit | 948c625f95d061e7f2608d9ead20d1fd05a64cd0 (patch) | |
tree | aa20a26aeeaaffb5c7f5f632325c682c2c6444ce /lib | |
parent | 961b7a9f6672c5422738364bea45a19060a8de5e (diff) | |
download | Nim-948c625f95d061e7f2608d9ead20d1fd05a64cd0.tar.gz |
undo more stuff
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/collections/tables.nim | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index ce87deea0..e7a4d1de0 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -880,50 +880,6 @@ proc del*[A, B](t: var OrderedTableRef[A, B], key: A) = t[].del(key) -template withValue*[A, B](t: var OrderedTable[A, B], key: A, value, body: untyped) = - ## retrieves the value at ``t[key]``. - ## ``value`` can be modified in the scope of the ``withValue`` call. - ## - ## .. code-block:: nim - ## - ## orderedTable.withValue(key, value) do: - ## # block is executed only if ``key`` in ``t`` - ## value.name = "username" - ## value.uid = 1000 - ## - mixin rawGet - var hc: Hash - var index = rawGet(t, key, hc) - let hasKey = index >= 0 - if hasKey: - var value {.inject.} = addr(t.data[index].val) - body - -template withValue*[A, B](t: var OrderedTable[A, B], key: A, - value, body1, body2: untyped) = - ## retrieves the value at ``t[key]``. - ## ``value`` can be modified in the scope of the ``withValue`` call. - ## - ## .. code-block:: nim - ## - ## orderedTable.withValue(key, value) do: - ## # block is executed only if ``key`` in ``t`` - ## value.name = "username" - ## value.uid = 1000 - ## do: - ## # block is executed when ``key`` not in ``t`` - ## raise newException(KeyError, "Key not found") - ## - mixin rawGet - var hc: Hash - var index = rawGet(t, key, hc) - let hasKey = index >= 0 - if hasKey: - var value {.inject.} = addr(t.data[index].val) - body1 - else: - body2 - # ------------------------------ count tables ------------------------------- type |