mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 03:14:08 +00:00
tgettypeinst works again; fixes an infinite recursion in signature hashing
This commit is contained in:
@@ -122,6 +122,7 @@ type
|
||||
ConsiderFlag* = enum
|
||||
CoProc
|
||||
CoType
|
||||
CoNoGeneric
|
||||
|
||||
proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||
if t == nil:
|
||||
@@ -144,7 +145,6 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||
return
|
||||
else:
|
||||
discard
|
||||
|
||||
c &= char(t.kind)
|
||||
case t.kind
|
||||
of tyBool, tyChar, tyInt..tyUInt64:
|
||||
@@ -153,10 +153,10 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||
if t.sym != nil and {sfImportc, sfExportc} * t.sym.flags != {}:
|
||||
c.hashSym(t.sym)
|
||||
of tyObject, tyEnum:
|
||||
if t.typeInst != nil:
|
||||
if t.typeInst != nil and CoNoGeneric notin flags:
|
||||
assert t.typeInst.kind == tyGenericInst
|
||||
for i in countup(1, sonsLen(t.typeInst) - 2):
|
||||
c.hashType t.typeInst.sons[i], flags
|
||||
c.hashType t.typeInst.sons[i], flags+{CoNoGeneric}
|
||||
# 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:
|
||||
|
||||
Reference in New Issue
Block a user