bug fix in sym body hash (#11127)

This commit is contained in:
cooldome 2019-04-27 14:31:05 +01:00 • committed by GitHub
commit da3b649539
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -349,7 +349,7 @@ proc hashBodyTree(graph: ModuleGraph, c: var MD5Context, n: PNode) =
c &= n.strVal c &= n.strVal
else: else:
for i in 0..<n.len: for i in 0..<n.len:
hashTree(c, n.sons[i]) hashBodyTree(graph, c, n.sons[i])
proc symBodyDigest*(graph: ModuleGraph, sym: PSym): SigHash = proc symBodyDigest*(graph: ModuleGraph, sym: PSym): SigHash =
## compute unique digest of the proc/func/method symbols ## compute unique digest of the proc/func/method symbols
@ -369,7 +369,7 @@ proc symBodyDigest*(graph: ModuleGraph, sym: PSym): SigHash =
if sym.ast != nil: if sym.ast != nil:
md5Init(c) md5Init(c)
c.md5Update(cast[cstring](result.addr), sizeof(result)) c.md5Update(cast[cstring](result.addr), sizeof(result))
c.hashTree(sym.ast[bodyPos]) hashBodyTree(graph, c, sym.ast[bodyPos])
c.md5Final(result.Md5Digest) c.md5Final(result.Md5Digest)
graph.symBodyHashes[sym.id] = result graph.symBodyHashes[sym.id] = result