diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-06-07 10:56:29 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-06-07 10:56:29 +0200 |
commit | bbb1bdb4a939aa43ed981acc2f96bce918be7d21 (patch) | |
tree | 939fb5e27650e4e7a24698b3c3dac5acada396b1 /lib/core | |
parent | 94b7da4297558dc85b047f6ddd91201895f54d0c (diff) | |
parent | 7fb5932b9bad02cd9b056cd3a11e514acc94d781 (diff) | |
download | Nim-bbb1bdb4a939aa43ed981acc2f96bce918be7d21.tar.gz |
Merge pull request #2643 from grncdr/TAny-and-inheritance
Resolve base type fields in `[](TAny, string)`
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/typeinfo.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim index d7fa2ec9b..ab150b2a4 100644 --- a/lib/core/typeinfo.nim +++ b/lib/core/typeinfo.nim @@ -340,6 +340,8 @@ proc `[]`*(x: Any, fieldName: string): Any = 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) |