This commit returns to a bit less strict checking of the number of macro arguments, because some old immediate macros rely on a behavior where even the arity of the macro is not being checked. It may be better if such macros are just declared to use varargs[expr], but this remains for another day.
This commit is contained in:
parent
6e358e3187
commit
1be0022e7c
17 changed files with 134 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ discard """
|
|||
import
|
||||
macros, strutils
|
||||
|
||||
macro test_macro*(n: stmt): stmt {.immediate.} =
|
||||
macro test_macro*(s: string, n: stmt): stmt {.immediate.} =
|
||||
result = newNimNode(nnkStmtList)
|
||||
var ass : NimNode = newNimNode(nnkAsgn)
|
||||
add(ass, newIdentNode("str"))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ discard """
|
|||
|
||||
import macros
|
||||
|
||||
macro quoteWords(n: expr): expr {.immediate.} =
|
||||
macro quoteWords(n: varargs[expr]): expr {.immediate.} =
|
||||
let n = callsite()
|
||||
result = newNimNode(nnkBracket, n)
|
||||
for i in 1..n.len-1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue