summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorYury Benesh <ybxsoft@tut.by>2012-11-21 23:42:11 +0300
committerYury Benesh <ybxsoft@tut.by>2012-11-21 23:42:11 +0300
commitb0388073c43e647688ed8cdcf4d83291d0132411 (patch)
treed0ae8c72735779580404d45ed818df7dfb95ab24 /lib
parent022ff2e86e12b1920a73b67878cd9ee05293d15d (diff)
downloadNim-b0388073c43e647688ed8cdcf4d83291d0132411.tar.gz
Added base() proc to typeinfo.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/core/typeinfo.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim
index 3032ccb19..26a14f444 100755
--- a/lib/core/typeinfo.nim
+++ b/lib/core/typeinfo.nim
@@ -198,6 +198,13 @@ proc len*(x: TAny): int =
   of tySequence: result = cast[PGenSeq](cast[ppointer](x.value)[]).len
   else: assert false
 
+
+proc base*(x: TAny): TAny =
+  ## returns base TAny (useful for inherited object types).
+  result.rawType = x.rawType.base
+  result.value = x.value
+
+
 proc isNil*(x: TAny): bool =
   ## `isNil` for an any `x` that represents a sequence, string, cstring,
   ## proc or some pointer type.