Clean up macros (#14959)
This commit is contained in:
parent
2b0e336c97
commit
9465b5db44
8 changed files with 6 additions and 43 deletions
|
|
@ -1,6 +1,5 @@
|
|||
discard """
|
||||
output: '''
|
||||
HELLO WORLD
|
||||
c_func
|
||||
12
|
||||
'''
|
||||
|
|
@ -8,8 +7,6 @@ c_func
|
|||
|
||||
import macros, strutils
|
||||
|
||||
emit("echo " & '"' & "hello world".toUpperAscii & '"')
|
||||
|
||||
# bug #1025
|
||||
|
||||
macro foo(icname): untyped =
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ macro optFormat{`%`(f, a)}(f: string{lit}, a: openArray[string]): untyped =
|
|||
result = newNimNode(nnkBracket)
|
||||
let f = f.strVal
|
||||
formatImpl(newLit)
|
||||
result = nestList(!"&", result)
|
||||
result = nestList(newIdentNode("&"), result)
|
||||
|
||||
template optAdd1{x = y; add(x, z)}(x, y, z: string) =
|
||||
x = y & z
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ macro autoClose(args: varargs[untyped]): untyped =
|
|||
varAssignment.add(varValue)
|
||||
variables.add(varAssignment)
|
||||
|
||||
closingCalls.add(newCall(!"close", varName))
|
||||
closingCalls.add(newCall(newIdentNode("close"), varName))
|
||||
else:
|
||||
error "Using statement: Unexpected expression. Got " &
|
||||
$args[i].kind & " instead of assignment."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue