distinguish between 'reorder' and 'noforward'
This commit is contained in:
parent
e00953cbc0
commit
50f62ff44a
5 changed files with 53 additions and 8 deletions
42
tests/modules/treorder.nim
Normal file
42
tests/modules/treorder.nim
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
discard """
|
||||
cmd: "nim -d:testdef $target $file"
|
||||
output: '''works 34
|
||||
34
|
||||
defined
|
||||
first impl'''
|
||||
"""
|
||||
|
||||
{.reorder: on.}
|
||||
|
||||
{.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)
|
||||
|
||||
foo()
|
||||
|
||||
type
|
||||
T = int
|
||||
|
||||
when defined(testdef):
|
||||
proc whendep() = echo "defined"
|
||||
else:
|
||||
proc whendep() = echo "undefined"
|
||||
|
||||
when not declared(goo):
|
||||
proc goo() = echo "first impl"
|
||||
|
||||
when not declared(goo):
|
||||
proc goo() = echo "second impl"
|
||||
|
||||
goo()
|
||||
|
||||
{.pop.}
|
||||
Loading…
Add table
Add a link
Reference in a new issue