summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStephen Sugden <grncdr@users.noreply.github.com>2015-05-03 00:16:22 +0200
committerStephen Sugden <grncdr@users.noreply.github.com>2015-05-03 00:16:22 +0200
commit7fb5932b9bad02cd9b056cd3a11e514acc94d781 (patch)
tree2f25fcf9c7615d695036ca6c6ca90398a7bf331c
parentfe268b7df7f6b8f7dbfc7eba9c159c6bca769520 (diff)
downloadNim-7fb5932b9bad02cd9b056cd3a11e514acc94d781.tar.gz
Resolve base type fields in `[](TAny, string)`
-rw-r--r--lib/core/typeinfo.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim
index c3ff66591..f08f74c20 100644
--- a/lib/core/typeinfo.nim
+++ b/lib/core/typeinfo.nim
@@ -339,6 +339,8 @@ proc `[]`*(x: TAny, fieldName: string): TAny =
   if n != nil:
     result.value = x.value +!! n.offset
     result.rawType = n.typ
+  elif x.rawType.kind == tyObject and x.rawType.base != nil:
+    return `[]`(TAny(value: x.value, rawType: x.rawType.base), fieldName)
   else:
     raise newException(ValueError, "invalid field name: " & fieldName)