few more fixes for static params in macros; new failing test cases for static evaluation

This commit is contained in:
Zahary Karadjov 2014-03-09 16:04:58 +02:00
commit 5aa486cf11
2 changed files with 58 additions and 15 deletions

View file

@ -4,18 +4,52 @@ discard """
3
1
2
3
1
2
3
1
2
3'''
"""
const s = @[1,2,3]
when false:
const s = @[1,2,3]
macro foo: stmt =
for e in s:
echo e
macro foo: stmt =
for e in s:
echo e
foo()
foo()
static:
for e in s:
echo e
macro bar(x: static[seq[int]]): stmt =
for e in x:
echo e
bar s
bar(@[1, 2, 3])
type
TData = tuple
letters: seq[string]
numbers: seq[int]
const data: TData = (@["aa", "bb"], @[11, 22])
static:
for e in s:
echo e
for x in data.letters:
echo x
var m = data
for x in m.letters:
echo x
macro ff(d: static[TData]): stmt =
for x in d.letters:
echo x
ff(data)