out parameters: enforce that 'out' is only used as a parameter (#20510)
* out parameters: enforce that 'out' is only used as a parameter * make tables.nim use 'out' parameters * better backwards compat
This commit is contained in:
parent
a132f5502a
commit
e83f27e6a0
5 changed files with 47 additions and 3 deletions
|
|
@ -13,6 +13,7 @@
|
|||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
import std / outparams
|
||||
|
||||
const
|
||||
growthFactor = 2
|
||||
|
|
@ -78,5 +79,5 @@ template rawGetImpl() {.dirty.} =
|
|||
genHashImpl(key, hc)
|
||||
rawGetKnownHCImpl()
|
||||
|
||||
proc rawGet[X, A](t: X, key: A, hc: var Hash): int {.inline.} =
|
||||
proc rawGet[X, A](t: X, key: A, hc: var Hash): int {.inline, outParamsAt: [3].} =
|
||||
rawGetImpl()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ template rawInsertImpl() {.dirty.} =
|
|||
data[h].val = val
|
||||
data[h].hcode = hc
|
||||
|
||||
proc rawGetDeep[X, A](t: X, key: A, hc: var Hash): int {.inline.} =
|
||||
proc rawGetDeep[X, A](t: X, key: A, hc: var Hash): int {.inline, outParamsAt: [3].} =
|
||||
rawGetDeepImpl()
|
||||
|
||||
proc rawInsert[X, A, B](t: var X, data: var KeyValuePairSeq[A, B],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue