diff options
author | LemonBoy <thatlemon@gmail.com> | 2018-09-14 15:29:34 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2018-09-14 15:37:51 +0200 |
commit | 839953c3e167828f93bdddd27ae88c5909c8aca9 (patch) | |
tree | dcdb7542d3420d2405f81d56297920d94424a7ec /compiler | |
parent | 382fe446c3926f7976de09b7a1d8ad131912c7b6 (diff) | |
download | Nim-839953c3e167828f93bdddd27ae88c5909c8aca9.tar.gz |
Fix hashing for codegenProc (sic) types
Since the name mangling is inhibited we should take the user-supplied name during the sighash computation. Fixes #8964
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sighashes.nim | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim index 8f95175e5..097695f82 100644 --- a/compiler/sighashes.nim +++ b/compiler/sighashes.nim @@ -68,6 +68,8 @@ else: toBase64a(cast[cstring](unsafeAddr u), sizeof(u)) proc `&=`(c: var MD5Context, s: string) = md5Update(c, s, s.len) proc `&=`(c: var MD5Context, ch: char) = md5Update(c, unsafeAddr ch, 1) + proc `&=`(c: var MD5Context, r: Rope) = + for l in leaves(r): md5Update(c, l, l.len) proc `&=`(c: var MD5Context, i: BiggestInt) = md5Update(c, cast[cstring](unsafeAddr i), sizeof(i)) @@ -181,11 +183,11 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) = # Every cyclic type in Nim need to be constructed via some 't.sym', so this # is actually safe without an infinite recursion check: if t.sym != nil: - #if "Future:" in t.sym.name.s and t.typeInst == nil: - # writeStackTrace() - # echo "yes ", t.sym.name.s - # #quit 1 - if CoOwnerSig in flags: + if {sfCompilerProc} * t.sym.flags != {}: + doAssert t.sym.loc.r != nil + # The user has set a specific name for this type + c &= t.sym.loc.r + elif CoOwnerSig in flags: c.hashTypeSym(t.sym) else: c.hashSym(t.sym) |