make nimforum compile again

This commit is contained in:
Araq 2016-12-31 11:37:35 +01:00
commit bf8f00f717
2 changed files with 5 additions and 1 deletions

View file

@ -12,7 +12,7 @@
import ast, md5 import ast, md5
from hashes import Hash from hashes import Hash
from astalgo import debug from astalgo import debug
from types import typeToString from types import typeToString, preferDesc
from strutils import startsWith, contains from strutils import startsWith, contains
when false: when false:
@ -185,12 +185,15 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
if sfAnon in t.sym.flags: if sfAnon in t.sym.flags:
# generated object names can be identical, so we need to # generated object names can be identical, so we need to
# disambiguate furthermore by hashing the field types and names: # disambiguate furthermore by hashing the field types and names:
# mild hack to prevent endless recursions (makes nimforum compile again):
excl t.sym.flags, sfAnon
let n = t.n let n = t.n
for i in 0 ..< n.len: for i in 0 ..< n.len:
assert n[i].kind == nkSym assert n[i].kind == nkSym
let s = n[i].sym let s = n[i].sym
c.hashSym s c.hashSym s
c.hashType s.typ, flags c.hashType s.typ, flags
incl t.sym.flags, sfAnon
else: else:
c &= t.id c &= t.id
if t.len > 0 and t.sons[0] != nil: if t.len > 0 and t.sons[0] != nil:

View file

@ -1,4 +1,5 @@
discard """ discard """
cmd: "nim c -r -f $file"
output: ''' output: '''
OK OK
OK OK