mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 14:25:23 +00:00
re-enable object name generation for less dependence on IDs
This commit is contained in:
@@ -114,9 +114,10 @@ proc createObj*(owner: PSym, info: TLineInfo): PType =
|
||||
rawAddSon(result, nil)
|
||||
incl result.flags, tfFinal
|
||||
result.n = newNodeI(nkRecList, info)
|
||||
when false:
|
||||
when true:
|
||||
let s = newSym(skType, getIdent("Env_" & info.toFilename & "_" & $info.line),
|
||||
owner, info)
|
||||
incl s.flags, sfAnon
|
||||
s.typ = result
|
||||
result.sym = s
|
||||
|
||||
|
||||
@@ -165,6 +165,15 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||
# echo "yes ", t.sym.name.s
|
||||
# #quit 1
|
||||
c.hashSym(t.sym)
|
||||
if sfAnon in t.sym.flags:
|
||||
# generated object names can be identical, so we need to
|
||||
# disambiguate furthermore by hashing the field types and names:
|
||||
let n = t.n
|
||||
for i in 0 ..< n.len:
|
||||
assert n[i].kind == nkSym
|
||||
let s = n[i].sym
|
||||
c.hashSym s
|
||||
c.hashType s.typ, flags
|
||||
else:
|
||||
c &= t.id
|
||||
of tyRef, tyPtr, tyGenericBody, tyVar:
|
||||
|
||||
Reference in New Issue
Block a user