mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-26 09:14:00 +00:00
transformed {.reorder: on.} into {.experimental: codeReordering.}, added tests
This commit is contained in:
@@ -2,7 +2,8 @@ discard """
|
||||
disabled: true
|
||||
"""
|
||||
|
||||
{. noforward: on .}
|
||||
# {. noforward: on .}
|
||||
{.experimental: "codeReordering".}
|
||||
|
||||
proc foo(x: int) =
|
||||
bar x
|
||||
|
||||
@@ -6,7 +6,8 @@ output:'''0
|
||||
"""
|
||||
|
||||
import macros
|
||||
{.reorder: on .}
|
||||
# {.reorder: on .}
|
||||
{.experimental: "codeReordering".}
|
||||
|
||||
echo foo(-1)
|
||||
echo callWithFoo(0)
|
||||
@@ -71,4 +72,4 @@ macro make(arg: untyped): untyped =
|
||||
proc first(i: int): void =
|
||||
make(second)
|
||||
|
||||
var ss {.compileTime.}: string = ""
|
||||
var ss {.compileTime.}: string = ""
|
||||
|
||||
12
tests/pragmas/treorderdeclared.nim
Normal file
12
tests/pragmas/treorderdeclared.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
discard """
|
||||
output:'''false'''
|
||||
"""
|
||||
|
||||
{.experimental: "codeReordering".}
|
||||
|
||||
proc x() =
|
||||
echo(declared(foo))
|
||||
|
||||
var foo = 4
|
||||
|
||||
x() # "false", the same as it would be with code reordering OFF
|
||||
Reference in New Issue
Block a user