mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-29 18:11:44 +00:00
allows access to .compileTime vars at runtime (#12128)
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user