diff options
author | Araq <rumpf_a@web.de> | 2013-03-16 17:07:47 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-03-16 17:07:47 +0100 |
commit | b63f322a466351bc57f8a4593009f0520c348527 (patch) | |
tree | ac80f1cd1a7c8b7b058ef51673dd65593a7dd827 /lib/core | |
parent | 78b27ed7fa121d2cb032fa1b74ae434034bf8e23 (diff) | |
download | Nim-b63f322a466351bc57f8a4593009f0520c348527.tar.gz |
debugger improvements
Diffstat (limited to 'lib/core')
-rwxr-xr-x | lib/core/typeinfo.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim index eb2a0c9e5..6f8081b5f 100755 --- a/lib/core/typeinfo.nim +++ b/lib/core/typeinfo.nim @@ -102,6 +102,16 @@ proc newAny(value: pointer, rawType: PNimType): TAny = result.value = value result.rawType = rawType +when defined(system.TVarSlot): + proc toAny*(x: TVarSlot): TAny {.inline.} = + ## constructs a ``TAny`` object from a variable slot ``x``. + ## This captures `x`'s address, so `x` can be modified with its + ## ``TAny`` wrapper! The client needs to ensure that the wrapper + ## **does not** live longer than `x`! + ## This is provided for easier reflection capabilities of a debugger. + result.value = x.address + result.rawType = x.typ + proc toAny*[T](x: var T): TAny {.inline.} = ## constructs a ``TAny`` object from `x`. This captures `x`'s address, so ## `x` can be modified with its ``TAny`` wrapper! The client needs to ensure |