t17045.nim 610 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. targets: "c cpp"
  3. matrix: "--mm:refc; --mm:arc"
  4. """
  5. type Future = ref object
  6. iterator paths: string =
  7. # without "when nimvm" everything works
  8. when nimvm:
  9. yield "test.md"
  10. else:
  11. yield "test.md"
  12. template await(f: Future): string =
  13. # need this yield, also the template has to return something
  14. yield f
  15. "hello world"
  16. proc generatePostContextsAsync() =
  17. iterator generatePostContextsAsyncIter(): Future {.closure.} =
  18. for filePath in paths():
  19. var temp = await Future()
  20. # need this line
  21. var nameIterVar = generatePostContextsAsyncIter
  22. generatePostContextsAsync()