diff options
author | Aditya Siram <aditya.siram@gmail.com> | 2020-12-03 06:40:28 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 13:40:28 +0100 |
commit | 23447ffdce7415e2313654a61bdd9a23803f6538 (patch) | |
tree | a80096268c15d90dbbfac5df2cabaf1e247073a8 /lib/core | |
parent | 849bc36edac47d5f62222ffc6beb015a770fc1f6 (diff) | |
download | Nim-23447ffdce7415e2313654a61bdd9a23803f6538.tar.gz |
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 <darkmine956@gmail.com>
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/macros.nim | 8 |
1 files changed, 4 insertions, 4 deletions
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..<params.len: + for j in 0..<params[i].len-2: + if name.eqIdent($params[i][j]): + return true proc addIdentIfAbsent*(dest: NimNode, ident: string) {.compileTime.} = ## Add ``ident`` to ``dest`` if it is not present. This is intended for use |