arc/orc no longer needs type names by default; with nimTypeNames it gets nicer names (#20789)
Co-authored-by: Araq <rumpf_a@web.de>
This commit is contained in:
parent
7d15fdd375
commit
cdb136f585
1 changed files with 16 additions and 20 deletions
|
|
@ -1273,27 +1273,23 @@ proc declareNimType(m: BModule, name: string; str: Rope, module: int) =
|
||||||
m.s[cfsStrData].addf("extern $2 $1;$n", [str, nr])
|
m.s[cfsStrData].addf("extern $2 $1;$n", [str, nr])
|
||||||
|
|
||||||
proc genTypeInfo2Name(m: BModule; t: PType): Rope =
|
proc genTypeInfo2Name(m: BModule; t: PType): Rope =
|
||||||
var res = "|"
|
|
||||||
var it = t
|
var it = t
|
||||||
while it != nil:
|
|
||||||
it = it.skipTypes(skipPtrs)
|
it = it.skipTypes(skipPtrs)
|
||||||
if it.sym != nil and tfFromGeneric notin it.flags:
|
if it.sym != nil and tfFromGeneric notin it.flags:
|
||||||
var m = it.sym.owner
|
var m = it.sym.owner
|
||||||
while m != nil and m.kind != skModule: m = m.owner
|
while m != nil and m.kind != skModule: m = m.owner
|
||||||
if m == nil or sfSystemModule in m.flags:
|
if m == nil or sfSystemModule in m.flags:
|
||||||
# produce short names for system types:
|
# produce short names for system types:
|
||||||
res.add it.sym.name.s
|
result = it.sym.name.s
|
||||||
else:
|
else:
|
||||||
var p = m.owner
|
var p = m.owner
|
||||||
if p != nil and p.kind == skPackage:
|
if p != nil and p.kind == skPackage:
|
||||||
res.add p.name.s & "."
|
result.add p.name.s & "."
|
||||||
res.add m.name.s & "."
|
result.add m.name.s & "."
|
||||||
res.add it.sym.name.s
|
result.add it.sym.name.s
|
||||||
else:
|
else:
|
||||||
res.add $hashType(it)
|
result = $hashType(it)
|
||||||
res.add "|"
|
result = makeCString(result)
|
||||||
it = it[0]
|
|
||||||
result = makeCString(res)
|
|
||||||
|
|
||||||
proc isTrivialProc(g: ModuleGraph; s: PSym): bool {.inline.} = getBody(g, s).len == 0
|
proc isTrivialProc(g: ModuleGraph; s: PSym): bool {.inline.} = getBody(g, s).len == 0
|
||||||
|
|
||||||
|
|
@ -1354,7 +1350,7 @@ proc genDisplay(t: PType, depth: int): Rope =
|
||||||
|
|
||||||
proc genTypeInfoV2Impl(m: BModule; t, origType: PType, name: Rope; info: TLineInfo) =
|
proc genTypeInfoV2Impl(m: BModule; t, origType: PType, name: Rope; info: TLineInfo) =
|
||||||
var typeName: Rope
|
var typeName: Rope
|
||||||
if t.kind in {tyObject, tyDistinct}:
|
if isDefined(m.config, "nimTypeNames") and t.kind in {tyObject, tyDistinct}:
|
||||||
if incompleteType(t):
|
if incompleteType(t):
|
||||||
localError(m.config, info, "request for RTTI generation for incomplete object: " &
|
localError(m.config, info, "request for RTTI generation for incomplete object: " &
|
||||||
typeToString(t))
|
typeToString(t))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue