Skip to content

Commit

Permalink
Beautify most cgen types so the signature is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez committed Aug 14, 2024
1 parent 13f13f5 commit b5cb3ac
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions compiler/ccgtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,8 @@ const
tyDistinct, tyRange, tyStatic, tyAlias, tySink,
tyInferred, tyOwned}

proc typeName(typ: PType; result: var Rope) =
let typ = typ.skipTypes(irrelevantForBackend)
result.add $typ.kind
if typ.sym != nil and typ.kind in {tyObject, tyEnum}:
result.add "_"
result.add typ.sym.name.s.mangle
proc typeName(m: BModule; typ: PType; result: var Rope) =
result.add m.encodeType(typ, maNone)

proc getTypeName(m: BModule; typ: PType; sig: SigHash): Rope =
var t = typ
Expand All @@ -155,8 +151,9 @@ proc getTypeName(m: BModule; typ: PType; sig: SigHash): Rope =
break
let typ = if typ.kind in {tyAlias, tySink, tyOwned}: typ.elementType else: typ
if typ.loc.snippet == "":
typ.typeName(typ.loc.snippet)
typ.loc.snippet.add $sig
m.typeName(typ, typ.loc.snippet)
if typ.kind in {tyProc} or typ.len == 1 and typ.kind == tyObject:
typ.loc.snippet.add $sig
else:
when defined(debugSigHashes):
# check consistency:
Expand Down Expand Up @@ -1134,7 +1131,7 @@ proc getTypeDescAux(m: BModule; origTyp: PType, check: var IntSet; kind: TypeDes
of tySet:
# Don't use the imported name as it may be scoped: 'Foo::SomeKind'
result = rope("tySet_")
t.elementType.typeName(result)
m.typeName(t.elementType, result)
result.add $t.elementType.hashType(m.config)
m.typeCache[sig] = result
if not isImportedType(t):
Expand Down

0 comments on commit b5cb3ac

Please sign in to comment.