From 7fb5932b9bad02cd9b056cd3a11e514acc94d781 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Sun, 3 May 2015 00:16:22 +0200 Subject: Resolve base type fields in `[](TAny, string)` --- lib/core/typeinfo.nim | 2 ++ 1 file changed, 2 insertions(+) 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) -- cgit 1.4.1-2-gfad0