From 23447ffdce7415e2313654a61bdd9a23803f6538 Mon Sep 17 00:00:00 2001 From: Aditya Siram Date: Thu, 3 Dec 2020 06:40:28 -0600 Subject: [PATCH] Fixes #16219, `hasArgOfName` ignoring argument sets. (#16233) * Fixes #16219, `hasArgOfName` ignoring argument sets. * Fix test and simplify ident traversal. * Moved test into a block and removed some boilerplate. * Fix some argument formatting. * use ..< * Change the preceding line too Co-authored-by: Clyybber --- lib/core/macros.nim | 8 ++++---- tests/stdlib/tmacros.nim | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests/stdlib/tmacros.nim diff --git a/lib/core/macros.nim b/lib/core/macros.nim index d2985bc72..97c3a46c5 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -1434,10 +1434,10 @@ proc expectIdent*(n: NimNode, name: string) {.compileTime, since: (1,1).} = proc hasArgOfName*(params: NimNode; name: string): bool {.compileTime.}= ## Search ``nnkFormalParams`` for an argument. expectKind(params, nnkFormalParams) - for i in 1 ..< params.len: - template node: untyped = params[i] - if name.eqIdent( $ node[0]): - return true + for i in 1..