summary refs log tree commit diff stats
path: root/tests/closure/tnested.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/closure/tnested.nim')
-rw-r--r--tests/closure/tnested.nim37
1 files changed, 28 insertions, 9 deletions
diff --git a/tests/closure/tnested.nim b/tests/closure/tnested.nim
index 7a1881a60..ec5af9b13 100644
--- a/tests/closure/tnested.nim
+++ b/tests/closure/tnested.nim
@@ -1,4 +1,5 @@
 discard """
+targets: "c js"
 output: '''
 foo88
 23 24foo 88
@@ -33,7 +34,7 @@ py
 py
 px
 6
-proc (){.closure, gcsafe, locks: 0.}
+proc (){.closure, noSideEffect, gcsafe.}
 '''
 """
 
@@ -183,14 +184,32 @@ block tclosure2:
 
 import typetraits
 
-proc myDiscard[T](a: T) = discard
+block:
+  proc myDiscard[T](a: T) = discard
 
-proc foo() =
-  let a = 5
-  let f = (proc() =
-             myDiscard (proc() = echo a)
-          )
-  echo name(type(f))
+  proc foo() =
+    let a = 5
+    let f = (proc() =
+              myDiscard (proc() = echo a)
+            )
+    echo name(typeof(f))
 
-foo()
+  foo()
 
+
+block:
+  iterator foo: int {.closure.} =
+    yield 1
+    yield 2
+    yield 3
+
+  proc pork =
+    let call = foo
+    for i in call():
+      discard i
+
+    let call2 = foo
+    while not finished(call2):
+      discard call2()
+
+  pork()
7:01 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-12-26 01:26:16 -0800 3709 - line numbers in html' href='/akkartik/mu/commit/html/real-files.mu.html?h=hlt&id=e5c11a5137d538b7713dd8708ca767c208824c06'>e5c11a51 ^
d990e8f0 ^
4a39d12d ^
d990e8f0 ^
e5c11a51 ^
d990e8f0 ^





e5c11a51 ^






















d990e8f0 ^


e5c11a51 ^
d990e8f0 ^
204dae92 ^




97eb971b ^
204dae92 ^







124c6764 ^
204dae92 ^


d990e8f0 ^



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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79