tstmtlist.nim 464 B

1234567891011121314151617181920212223242526272829303132333435
  1. discard """
  2. output: '''0
  3. |12|
  4. 34
  5. '''
  6. """
  7. template optWrite{
  8. write(f, x)
  9. ((write|writeLine){w})(f, y)
  10. }(x, y: varargs[untyped], f, w: untyped) =
  11. w(f, "|", x, y, "|")
  12. if true:
  13. echo "0"
  14. write stdout, "1"
  15. writeLine stdout, "2"
  16. write stdout, "3"
  17. echo "4"
  18. # bug #7972
  19. template optimizeLogWrites*{
  20. write(f, x)
  21. write(f, y)
  22. }(x, y: string{lit}, f: File) =
  23. write(f, x & y)
  24. proc foo() =
  25. const N = 1
  26. stdout.write("")
  27. stdout.write("")
  28. foo()