better support for view types (#15436)
* you can put borrows into tables * enforces mutating views only mutate mutable data
This commit is contained in:
parent
9c86f4867e
commit
86d7b63e2a
5 changed files with 139 additions and 11 deletions
|
|
@ -142,8 +142,10 @@ proc fixupCall(p: BProc, le, ri: PNode, d: var TLoc,
|
|||
proc genBoundsCheck(p: BProc; arr, a, b: TLoc)
|
||||
|
||||
proc reifiedOpenArray(n: PNode): bool {.inline.} =
|
||||
let x = trees.getRoot(n)
|
||||
if x != nil and x.kind == skParam:
|
||||
var x = n
|
||||
while x.kind in {nkAddr, nkHiddenAddr, nkHiddenStdConv, nkHiddenDeref}:
|
||||
x = x[0]
|
||||
if x.kind == nkSym and x.sym.kind == skParam:
|
||||
result = false
|
||||
else:
|
||||
result = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue