next steps for closure iterators
This commit is contained in:
parent
85a5bfe605
commit
37229df7fc
28 changed files with 164 additions and 71 deletions
28
tests/objects/tobject3.nim
Normal file
28
tests/objects/tobject3.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
type
|
||||
TFoo = ref object of TObject
|
||||
Data: int
|
||||
TBar = ref object of TFoo
|
||||
nil
|
||||
TBar2 = ref object of TBar
|
||||
d2: int
|
||||
|
||||
template super(self: TBar): TFoo = self
|
||||
|
||||
template super(self: TBar2): TBar = self
|
||||
|
||||
proc Foo(self: TFoo) =
|
||||
echo "TFoo"
|
||||
|
||||
#proc Foo(self: TBar) =
|
||||
# echo "TBar"
|
||||
# Foo(super(self))
|
||||
# works when this code is uncommented
|
||||
|
||||
proc Foo(self: TBar2) =
|
||||
echo "TBar2"
|
||||
Foo(super(self))
|
||||
|
||||
var b: TBar2
|
||||
new(b)
|
||||
|
||||
Foo(b)
|
||||
Loading…
Add table
Add a link
Reference in a new issue