summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-06-28 01:03:07 +0200
committerAraq <rumpf_a@web.de>2014-06-28 01:03:07 +0200
commit59f61bae05047a0f110ca419272dbe3d53a412a6 (patch)
tree515365fc9af2d973533fb292ca7b0749f5f1830d /tests
parent79586487be202ffb7499a8917ac33024ce9c3a16 (diff)
downloadNim-59f61bae05047a0f110ca419272dbe3d53a412a6.tar.gz
new jester compiles
Diffstat (limited to 'tests')
-rw-r--r--tests/closure/tjester.nim32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/closure/tjester.nim b/tests/closure/tjester.nim
new file mode 100644
index 000000000..48e5186f0
--- /dev/null
+++ b/tests/closure/tjester.nim
@@ -0,0 +1,32 @@
+discard """
+  output: '''baro0'''
+"""
+
+type
+  Future[T] = ref object
+    data: T
+    callback: proc () {.closure.}
+
+proc cbOuter(response: string) {.closure, discardable.} =
+  iterator cbIter(): Future[int] {.closure.} =
+    for i in 0..7:
+      proc foo(): int =
+        iterator fooIter(): Future[int] {.closure.} =
+          echo response, i
+          yield Future[int](data: 17)
+        var iterVar = fooIter
+        iterVar().data
+      yield Future[int](data: foo())
+      
+  var iterVar2 = cbIter
+  proc cb2() {.closure.} =
+    try:
+      if not finished(iterVar2):
+        let next = iterVar2()
+        if next != nil:
+          next.callback = cb2
+    except:
+      echo "WTF"
+  cb2()
+
+cbOuter "baro"