Add contains to std/macrocache (#21304)
* Add test cases * Implement contains for CacheSeq * Implement contains for CacheTable * Fix implementation of hasKey * Remove contains for CacheSeq Fix runnable examples I was accidently using --doccmd:skip so I didn't spot the failure locally * Implement hasKey as a VM callback instead of magic * Implement suggestions from PR Co-Authored-By: ringabout <ringabout@users.noreply.github.com> * Update lib/core/macrocache.nim --------- Co-authored-by: ringabout <ringabout@users.noreply.github.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
parent
ff8ab06720
commit
900fe8f501
3 changed files with 39 additions and 0 deletions
|
|
@ -284,6 +284,12 @@ proc registerAdditionalOps*(c: PCtx) =
|
|||
stackTrace2(c, "isExported() requires a symbol. '$#' is of kind '$#'" % [$n, $n.kind], n)
|
||||
setResult(a, sfExported in n.sym.flags)
|
||||
|
||||
registerCallback c, "stdlib.macrocache.hasKey", proc (a: VmArgs) =
|
||||
let
|
||||
table = getString(a, 0)
|
||||
key = getString(a, 1)
|
||||
setResult(a, table in c.graph.cacheTables and key in c.graph.cacheTables[table])
|
||||
|
||||
registerCallback c, "stdlib.vmutils.vmTrace", proc (a: VmArgs) =
|
||||
c.config.isVmTrace = getBool(a, 0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue