mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
vm: simplify (slot).Set code
Refcounter handles nil items just fine.
This commit is contained in:
parent
f2f66ad36e
commit
ae2395f55f
1 changed files with 1 additions and 6 deletions
|
@ -23,13 +23,8 @@ func (s slot) Set(i int, item stackitem.Item, refs *refCounter) {
|
||||||
if s[i] == item {
|
if s[i] == item {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
old := s[i]
|
refs.Remove(s[i])
|
||||||
s[i] = item
|
s[i] = item
|
||||||
if old != nil {
|
|
||||||
refs.Remove(old)
|
|
||||||
} else {
|
|
||||||
*refs-- // Not really existing, but counted Null element.
|
|
||||||
}
|
|
||||||
refs.Add(item)
|
refs.Add(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue