mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
use -d:nimTypeNames to create RTTI with type names
This commit is contained in:
@@ -816,6 +816,8 @@ proc genTypeInfoAuxBase(m: BModule; typ, origType: PType; name, base: Rope) =
|
||||
#else MessageOut("can contain a cycle: " & typeToString(typ))
|
||||
if flags != 0:
|
||||
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")
|
||||
addf(m.s[cfsVars], "TNimType $1; /* $2 */$n",
|
||||
[name, rope(typeToString(typ))])
|
||||
|
||||
@@ -86,6 +86,8 @@ type
|
||||
finalizer: pointer # the finalizer for the type
|
||||
marker: proc (p: pointer, op: int) {.nimcall, benign.} # marker proc for GC
|
||||
deepcopy: proc (p: pointer): pointer {.nimcall, benign.}
|
||||
when defined(nimTypeNames):
|
||||
name: cstring
|
||||
PNimType = ptr TNimType
|
||||
|
||||
# node.len may be the ``first`` element of a set
|
||||
|
||||
Reference in New Issue
Block a user