From abaac4d1bf6ce018a8244c1bb7a130bb8f93207d Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Thu, 31 Jan 2019 09:14:56 -0600 Subject: Fix cOverride crash on pragmas --- nimterop/cimport.nim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim index 298c8a2..6a78b5e 100644 --- a/nimterop/cimport.nim +++ b/nimterop/cimport.nim @@ -149,15 +149,17 @@ macro cOverride*(body): untyped = ## can be instructed to skip over ``svGetCallerInfo()``. This works for procs, ## consts and types. + proc recFindIdent(node: NimNode): seq[string] = + if node.kind != nnkIdent: + for child in node: + result.add recFindIdent(child) + if result.len != 0 and node.kind notin [nnkTypeSection, nnkConstSection]: + break + elif $node != "*": + result.add $node + for sym in body: - case sym.kind: - of nnkProcDef: - gStateCT.symOverride.add ($sym[0]).strip(chars={'*'}) - of nnkConstSection, nnkTypeSection: - for ssym in sym: - gStateCT.symOverride.add ($ssym[0]).strip(chars={'*'}) - else: - discard + gStateCT.symOverride.add recFindIdent(sym) result = body -- cgit v1.2.3