use -d:nimTypeNames to create RTTI with type names
This commit is contained in:
parent
e83d11e8f1
commit
7ca72a733c
2 changed files with 4 additions and 0 deletions
|
|
@ -816,6 +816,8 @@ proc genTypeInfoAuxBase(m: BModule; typ, origType: PType; name, base: Rope) =
|
||||||
#else MessageOut("can contain a cycle: " & typeToString(typ))
|
#else MessageOut("can contain a cycle: " & typeToString(typ))
|
||||||
if flags != 0:
|
if flags != 0:
|
||||||
addf(m.s[cfsTypeInit3], "$1.flags = $2;$n", [name, rope(flags)])
|
addf(m.s[cfsTypeInit3], "$1.flags = $2;$n", [name, rope(flags)])
|
||||||
|
if isDefined("nimTypeNames"):
|
||||||
|
addf(m.s[cfsTypeInit3], "$1.name = $2;$n", [name, makeCstring typeToString origType])
|
||||||
discard cgsym(m, "TNimType")
|
discard cgsym(m, "TNimType")
|
||||||
addf(m.s[cfsVars], "TNimType $1; /* $2 */$n",
|
addf(m.s[cfsVars], "TNimType $1; /* $2 */$n",
|
||||||
[name, rope(typeToString(typ))])
|
[name, rope(typeToString(typ))])
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,8 @@ type
|
||||||
finalizer: pointer # the finalizer for the type
|
finalizer: pointer # the finalizer for the type
|
||||||
marker: proc (p: pointer, op: int) {.nimcall, benign.} # marker proc for GC
|
marker: proc (p: pointer, op: int) {.nimcall, benign.} # marker proc for GC
|
||||||
deepcopy: proc (p: pointer): pointer {.nimcall, benign.}
|
deepcopy: proc (p: pointer): pointer {.nimcall, benign.}
|
||||||
|
when defined(nimTypeNames):
|
||||||
|
name: cstring
|
||||||
PNimType = ptr TNimType
|
PNimType = ptr TNimType
|
||||||
|
|
||||||
# node.len may be the ``first`` element of a set
|
# node.len may be the ``first`` element of a set
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue