rewrote lambdalifting; fixes deeply nested closures
This commit is contained in:
parent
e712dbaef5
commit
eed443d4b3
15 changed files with 458 additions and 298 deletions
|
|
@ -1,7 +1,6 @@
|
|||
discard """
|
||||
file: "tclosure.nim"
|
||||
output: "2 4 6 8 10"
|
||||
disabled: true
|
||||
output: "1 3 6 11 20"
|
||||
"""
|
||||
# Test the closure implementation
|
||||
|
||||
|
|
@ -30,7 +29,8 @@ proc testA() =
|
|||
testA()
|
||||
|
||||
myData.each do (x: int):
|
||||
write(stout, x)
|
||||
write(stdout, x)
|
||||
write(stdout, " ")
|
||||
|
||||
#OUT 2 4 6 8 10
|
||||
|
||||
|
|
@ -42,6 +42,6 @@ type
|
|||
proc getInterf(): ITest =
|
||||
var shared: int
|
||||
|
||||
return (setter: proc (x) = shared = x,
|
||||
return (setter: proc (x: int) = shared = x,
|
||||
getter: proc (): int = return shared)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue