forked from TrueCloudLab/neoneo-go
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 {
|
||||
return
|
||||
}
|
||||
old := s[i]
|
||||
refs.Remove(s[i])
|
||||
s[i] = item
|
||||
if old != nil {
|
||||
refs.Remove(old)
|
||||
} else {
|
||||
*refs-- // Not really existing, but counted Null element.
|
||||
}
|
||||
refs.Add(item)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue