Merge pull request #260 from exhu/master

base() proc for typeinfo module
This commit is contained in:
Araq
2012-11-21 14:04:19 -08:00

View File

@@ -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.