diff options
author | Yury Benesh <ybxsoft@tut.by> | 2012-11-21 23:42:11 +0300 |
---|---|---|
committer | Yury Benesh <ybxsoft@tut.by> | 2012-11-21 23:42:11 +0300 |
commit | b0388073c43e647688ed8cdcf4d83291d0132411 (patch) | |
tree | d0ae8c72735779580404d45ed818df7dfb95ab24 /lib | |
parent | 022ff2e86e12b1920a73b67878cd9ee05293d15d (diff) | |
download | Nim-b0388073c43e647688ed8cdcf4d83291d0132411.tar.gz |
Added base() proc to typeinfo.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/core/typeinfo.nim | 7 |
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. |