diff options
author | Miran <narimiran@disroot.org> | 2019-06-08 00:34:11 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-06-08 00:34:11 +0200 |
commit | bf9f1f7b45a4fa04cf7995c95af88680b2710f8c (patch) | |
tree | 04d499aa11bebdfe40d0c7e31429caca693f2f67 /lib | |
parent | bf63d83a9759b6764a0b78b424f4635af35d743f (diff) | |
download | Nim-bf9f1f7b45a4fa04cf7995c95af88680b2710f8c.tar.gz |
[bugfix] hashes: fix regression for nested containers (#11426)
Move forward declarations earlier.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/hashes.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim index df29dc080..c8b9f0e06 100644 --- a/lib/pure/hashes.nim +++ b/lib/pure/hashes.nim @@ -149,6 +149,12 @@ proc hash*(x: float): Hash {.inline.} = var y = x + 1.0 result = cast[ptr Hash](addr(y))[] + +# Forward declarations before methods that hash containers. This allows +# containers to contain other containers +proc hash*[A](x: openArray[A]): Hash +proc hash*[A](x: set[A]): Hash + template bytewiseHashing(result: Hash, x: typed, start, stop: int) = for i in start .. stop: result = result !& hash(x[i]) @@ -292,12 +298,6 @@ proc hashIgnoreCase*(sBuf: string, sPos, ePos: int): Hash = result = !$h -# Forward declarations before methods that hash containers. This allows -# containers to contain other containers -proc hash*[A](x: openArray[A]): Hash -proc hash*[A](x: set[A]): Hash - - proc hash*[T: tuple](x: T): Hash = ## Efficient hashing of tuples. for f in fields(x): |