Change expr/stmt in examples to untyped (#6734)

This commit is contained in:
Lynn C. Rees 2017-11-15 13:58:11 -07:00 • committed by Andreas Rumpf
commit ac5dff2e04
16 changed files with 56 additions and 119 deletions

View file

@ -5,7 +5,7 @@ import macros
proc invalidFormatString() =
echo "invalidFormatString"
template formatImpl(handleChar: expr) =
template formatImpl(handleChar: untyped) =
var i = 0
while i < f.len:
if f[i] == '$':
@ -24,11 +24,11 @@ template formatImpl(handleChar: expr) =
i += 1
proc `%`*(f: string, a: openArray[string]): string =
template identity(x: expr): expr = x
template identity(x: untyped): untyped = x
result = ""
formatImpl(identity)
macro optFormat{`%`(f, a)}(f: string{lit}, a: openArray[string]): expr =
macro optFormat{`%`(f, a)}(f: string{lit}, a: openArray[string]): untyped =
result = newNimNode(nnkBracket)
#newCall("&")
let f = f.strVal