bugfixes and improvements for term rewriting macros
This commit is contained in:
parent
3a1a197664
commit
30c00aba07
5 changed files with 30 additions and 19 deletions
|
|
@ -15,5 +15,5 @@ template optConc{ `&&` * a }(a: expr): expr = &&a
|
|||
let space = " "
|
||||
echo "my" && (space & "awe" && "some " ) && "concat"
|
||||
|
||||
# check that it's been properly optimized:
|
||||
# check that it's been optimized properly:
|
||||
doAssert calls == 1
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ discard """
|
|||
"""
|
||||
|
||||
template optWrite{
|
||||
write(stdout, x)
|
||||
write(stdout, y)
|
||||
}(x, y: string) =
|
||||
write(stdout, "|", x, y, "|")
|
||||
write(f, x)
|
||||
((write|writeln){w})(f, y)
|
||||
}(x, y: varargs[expr], f, w: expr) =
|
||||
w(f, "|", x, y, "|")
|
||||
|
||||
if true:
|
||||
echo "0"
|
||||
write stdout, "1"
|
||||
write stdout, "2"
|
||||
writeln stdout, "2"
|
||||
write stdout, "3"
|
||||
echo "4"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue