allows access to .compileTime vars at runtime (#12128)

This commit is contained in:
Andreas Rumpf 2019-09-05 11:56:32 +02:00 • committed by GitHub
commit a5e2db2ac5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 14 deletions

View file

@ -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]