blob: 2f4a79daa393aa646811269106211599d8b61145 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
discard """
targets: "cpp"
cmd: "nim cpp $file"
output: '''
abc called
def called
abc called
'''
"""
type Foo = object
proc abc(this: Foo, x: int): void {.member: "$1('2 #2)".}
proc def(this: Foo, y: int): void {.virtual: "$1('2 #2)".}
proc abc(this: Foo, x: int): void =
echo "abc called"
if x > 0:
this.def(x - 1)
proc def(this: Foo, y: int): void =
echo "def called"
this.abc(y)
var x = Foo()
x.abc(1)
|