mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 02:42:05 +00:00
* late instantiation for the generic procs' default param values * automatic mixin behaviour in concepts Other fixes: * don't render the automatically inserted default params in calls * better rendering of tyFromExpr
27 lines
488 B
Nim
27 lines
488 B
Nim
import
|
|
hashes, tables, trie_database
|
|
|
|
type
|
|
MemDBTable = Table[KeccakHash, string]
|
|
|
|
MemDB* = object
|
|
tbl: MemDBTable
|
|
|
|
proc hash*(key: KeccakHash): int =
|
|
hashes.hash(key.data)
|
|
|
|
proc get*(db: MemDB, key: KeccakHash): string =
|
|
db.tbl[key]
|
|
|
|
proc del*(db: var MemDB, key: KeccakHash): bool =
|
|
if db.tbl.hasKey(key):
|
|
db.tbl.del(key)
|
|
return true
|
|
else:
|
|
return false
|
|
|
|
proc put*(db: var MemDB, key: KeccakHash, value: string): bool =
|
|
db.tbl[key] = value
|
|
return true
|
|
|