diff options
Diffstat (limited to 'core/coroutines.nom')
| -rw-r--r-- | core/coroutines.nom | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/coroutines.nom b/core/coroutines.nom index 52467c1..6e7d9e3 100644 --- a/core/coroutines.nom +++ b/core/coroutines.nom @@ -4,6 +4,17 @@ use "core/metaprogramming.nom" +test: + %nums = [] + %co = (..) + coroutine: + -> 4 + -> 5 + repeat 3 times: -> 6 + + for % in coroutine %co: add % to %nums + assume (%nums == [4, 5, 6, 6, 6]) or barf "Coroutine iteration failed" + compile [coroutine %body, generator %body] to (..) Lua value ".." (function() @@ -16,4 +27,4 @@ compile [for % in coroutine %co %body] to (..) Lua ".." for junk,\(% as lua expr) in coroutine.wrap(\(%co as lua expr)) do \(%body as lua statements) - end
\ No newline at end of file + end |
