Reflection/List methods: Difference between revisions

m
Updated for Nim 1.4: added missing {.base.} in method “e”.
m (Updated for Nim 1.4: added missing {.base.} in method “e”.)
Line 680:
.._]: procs.add($name)
result = newLit(procs)
 
 
type Bar = object
proc a*(b: Bar) = discard
Line 687:
template c*(b: var Bar, c: float) = discard
iterator d*(b: ptr Bar):int = discard
method e*(b:ref Bar) {.base.} = discard
proc second_param*(a: int, b: Bar) = discard #will not match
proc unexported(a: Bar) = discard #will not match
 
 
template thisfile:string =
instantiationInfo().filename
echo thisfile.listMethods(Bar)
 
#works for any module:
#const lib = "/path/to/nim/lib/pure/collections/tables.nim"
Anonymous user