treorder.nim 562 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. discard """
  2. cmd: "nim -d:testdef $target $file"
  3. output: '''works 34
  4. 34
  5. defined
  6. 3'''
  7. """
  8. {.reorder: on.}
  9. {.experimental.}
  10. {.push callconv: stdcall.}
  11. proc bar(x: T)
  12. proc foo() =
  13. bar(34)
  14. whendep()
  15. proc foo(dummy: int) = echo dummy
  16. proc bar(x: T) =
  17. echo "works ", x
  18. foo(x)
  19. foo()
  20. type
  21. T = int
  22. when defined(testdef):
  23. proc whendep() = echo "defined"
  24. else:
  25. proc whendep() = echo "undefined"
  26. when not declared(goo):
  27. proc goo(my, omy) = echo my
  28. when not declared(goo):
  29. proc goo(my, omy) = echo omy
  30. using
  31. my, omy: int
  32. goo(3, 4)
  33. {.pop.}