fixes #2841
This commit is contained in:
parent
b0b716fca7
commit
8594faa543
3 changed files with 53 additions and 43 deletions
|
|
@ -345,7 +345,7 @@ proc `[]`*(x: Any, fieldName: string): Any =
|
||||||
result.value = x.value +!! n.offset
|
result.value = x.value +!! n.offset
|
||||||
result.rawType = n.typ
|
result.rawType = n.typ
|
||||||
elif x.rawType.kind == tyObject and x.rawType.base != nil:
|
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:
|
else:
|
||||||
raise newException(ValueError, "invalid field name: " & fieldName)
|
raise newException(ValueError, "invalid field name: " & fieldName)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -399,6 +399,10 @@ typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(
|
||||||
# define NIM_EXTERNC
|
# define NIM_EXTERNC
|
||||||
#endif
|
#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 ----------------------- */
|
/* ---------------- platform specific includes ----------------------- */
|
||||||
|
|
||||||
/* VxWorks related includes */
|
/* VxWorks related includes */
|
||||||
|
|
|
||||||
6
tests/cpp/ttypeinfo2.nim
Normal file
6
tests/cpp/ttypeinfo2.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
discard """
|
||||||
|
cmd: "nim cpp $file"
|
||||||
|
"""
|
||||||
|
# bug #2841
|
||||||
|
import typeinfo
|
||||||
|
var tt: Any
|
||||||
Loading…
Add table
Add a link
Reference in a new issue