Files
Nim/tests/modules/treorder.nim
ringabout 8d254a5945 fixes #24053; fixes #18288; relax reorder with push/pop pragmas restrictions; no crossing push/pop barriers (#24061)
fixes #24053;
fixes #18288

makes push pragmas depend on each node before it and nodes after it
depend on it

(cherry picked from commit c10f84b9d7)
2024-09-08 08:42:53 +02:00

48 lines
551 B
Nim

discard """
matrix: "-d:testdef"
output: '''works 34
34
defined
3'''
"""
{.experimental: "codeReordering".}
{.push callconv: stdcall.}
proc bar(x: T)
proc foo() =
bar(34)
whendep()
proc foo(dummy: int) = echo dummy
proc bar(x: T) =
echo "works ", x
foo(x)
when defined(testdef):
proc whendep() = echo "defined"
else:
proc whendep() = echo "undefined"
foo()
type
T = int
when not declared(goo):
proc goo(my, omy) = echo my
when not declared(goo):
proc goo(my, omy) = echo omy
using
my, omy: int
goo(3, 4)
{.pop.}