templates can access hidden fields

This commit is contained in:
Araq 2013-12-25 14:53:00 +01:00
commit 9e92455a53
6 changed files with 61 additions and 42 deletions

View file

@ -0,0 +1,9 @@
type
Foo* = object
fooa, foob: int
proc createFoo*(a, b: int): Foo = Foo(fooa: a, foob: b)
template geta*(f: Foo): expr = f.fooa

View file

@ -0,0 +1,9 @@
discard """
output: 33
"""
import mcan_access_hidden_field
var myfoo = createFoo(33, 44)
echo myfoo.geta