Empty check in shallow [backport] (#9676)
This commit is contained in:
parent
b78699917e
commit
6ff596d4f8
2 changed files with 25 additions and 0 deletions
|
|
@ -4017,6 +4017,7 @@ proc shallow*[T](s: var seq[T]) {.noSideEffect, inline.} =
|
|||
## marks a sequence `s` as `shallow`:idx:. Subsequent assignments will not
|
||||
## perform deep copies of `s`. This is only useful for optimization
|
||||
## purposes.
|
||||
if s.len == 0: return
|
||||
when not defined(JS) and not defined(nimscript):
|
||||
var s = cast[PGenericSeq](s)
|
||||
s.reserved = s.reserved or seqShallowFlag
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue