allows access to .compileTime vars at runtime (#12128)
This commit is contained in:
parent
58bcf6cd46
commit
a5e2db2ac5
5 changed files with 52 additions and 14 deletions
|
|
@ -3,7 +3,10 @@ discard """
|
|||
3
|
||||
4:2
|
||||
Got Hi
|
||||
Got Hey'''
|
||||
Got Hey
|
||||
a
|
||||
b
|
||||
c'''
|
||||
"""
|
||||
|
||||
# bug #404
|
||||
|
|
@ -47,3 +50,9 @@ addStuff("Hey"): echo "Hey"
|
|||
addStuff("Hi"): echo "Hi"
|
||||
dump()
|
||||
|
||||
# ensure .compileTime vars can be used at runtime:
|
||||
import macros
|
||||
|
||||
var xzzzz {.compileTime.}: array[3, string] = ["a", "b", "c"]
|
||||
|
||||
for i in 0..high(xzzzz): echo xzzzz[i]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue