This commit is contained in:
Araq 2015-07-22 17:08:21 +02:00
commit 8594faa543
3 changed files with 53 additions and 43 deletions

View file

@ -345,7 +345,7 @@ proc `[]`*(x: Any, fieldName: string): Any =
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)
return `[]`(Any(value: x.value, rawType: x.rawType.base), fieldName)
else:
raise newException(ValueError, "invalid field name: " & fieldName)

View file

@ -399,6 +399,10 @@ typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(
# define NIM_EXTERNC
#endif
/* we have to tinker with TNimType as it's both part of system.nim and
typeinfo.nim but system.nim doesn't export it cleanly... */
typedef struct TNimType TNimType;
/* ---------------- platform specific includes ----------------------- */
/* VxWorks related includes */

6
tests/cpp/ttypeinfo2.nim Normal file
View file

@ -0,0 +1,6 @@
discard """
cmd: "nim cpp $file"
"""
# bug #2841
import typeinfo
var tt: Any