diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-01-31 09:14:56 -0600 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-01-31 09:14:56 -0600 |
| commit | abaac4d1bf6ce018a8244c1bb7a130bb8f93207d (patch) | |
| tree | 2a88fcaaa135e462e36becb97d6a67838d846100 | |
| parent | 5f70b01302169d1f5f970597c67893a79d18a989 (diff) | |
| download | nimterop-abaac4d1bf6ce018a8244c1bb7a130bb8f93207d.tar.gz nimterop-abaac4d1bf6ce018a8244c1bb7a130bb8f93207d.zip | |
Fix cOverride crash on pragmas
| -rw-r--r-- | nimterop/cimport.nim | 18 |
1 files 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 |
