tgettypeinst works again; fixes an infinite recursion in signature hashing
This commit is contained in:
parent
36a9703866
commit
066fbaf271
1 changed files with 3 additions and 3 deletions
|
|
@ -122,6 +122,7 @@ type
|
||||||
ConsiderFlag* = enum
|
ConsiderFlag* = enum
|
||||||
CoProc
|
CoProc
|
||||||
CoType
|
CoType
|
||||||
|
CoNoGeneric
|
||||||
|
|
||||||
proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||||
if t == nil:
|
if t == nil:
|
||||||
|
|
@ -144,7 +145,6 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
c &= char(t.kind)
|
c &= char(t.kind)
|
||||||
case t.kind
|
case t.kind
|
||||||
of tyBool, tyChar, tyInt..tyUInt64:
|
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 != {}:
|
if t.sym != nil and {sfImportc, sfExportc} * t.sym.flags != {}:
|
||||||
c.hashSym(t.sym)
|
c.hashSym(t.sym)
|
||||||
of tyObject, tyEnum:
|
of tyObject, tyEnum:
|
||||||
if t.typeInst != nil:
|
if t.typeInst != nil and CoNoGeneric notin flags:
|
||||||
assert t.typeInst.kind == tyGenericInst
|
assert t.typeInst.kind == tyGenericInst
|
||||||
for i in countup(1, sonsLen(t.typeInst) - 2):
|
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
|
# Every cyclic type in Nim need to be constructed via some 't.sym', so this
|
||||||
# is actually safe without an infinite recursion check:
|
# is actually safe without an infinite recursion check:
|
||||||
if t.sym != nil:
|
if t.sym != nil:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue