Remove expr/stmt (#5857)

This commit is contained in:
Arne Döring 2017-07-25 09:28:23 +02:00 • committed by Andreas Rumpf
commit 000b8afd26
168 changed files with 497 additions and 529 deletions

View file

@ -15,7 +15,7 @@ proc fac[T](x: T): T =
if x <= 1: return 1
else: return x.`*`(fac(x-1))
macro macrotest(n: expr): stmt {.immediate.} =
macro macrotest(n: varargs[untyped]): untyped =
let n = callsite()
expectKind(n, nnkCall)
expectMinLen(n, 2)
@ -24,7 +24,7 @@ macro macrotest(n: expr): stmt {.immediate.} =
result.add(newCall("write", n[1], n[i]))
result.add(newCall("writeLine", n[1], newStrLitNode("")))
macro debug(n: expr): stmt {.immediate.} =
macro debug(n: untyped): untyped {.immediate.} =
let n = callsite()
result = newNimNode(nnkStmtList, n)
for i in 1..n.len-1:
@ -82,4 +82,3 @@ for i in 2..6:
when isMainModule:
{.hint: "this is the main file".}

View file

@ -8,7 +8,7 @@ Success'''
var testNumber = 0
template test(opr, a, b, c: expr): stmt {.immediate.} =
template test(opr, a, b, c: untyped): untyped =
# test the expression at compile and runtime
block:
const constExpr = opr(a, b)

View file

@ -118,7 +118,7 @@ proc toTable*[A, B](pairs: openarray[tuple[key: A,
result = initTable[A, B](nextPowerOfTwo(pairs.len+10))
for key, val in items(pairs): result[key] = val
template dollarImpl(): stmt =
template dollarImpl(): typed =
if t.len == 0:
result = "{:}"
else:
@ -305,5 +305,3 @@ proc countTableTest1 =
countTableTest1()
echo true