vm: support immutable compound types
This commit is contained in:
parent
107f5e0793
commit
7296f0c913
10 changed files with 102 additions and 15 deletions
21
pkg/vm/stackitem/immutable.go
Normal file
21
pkg/vm/stackitem/immutable.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package stackitem
|
||||
|
||||
type ro struct {
|
||||
isReadOnly bool
|
||||
}
|
||||
|
||||
// IsReadOnly implements Immutable interface.
|
||||
func (r *ro) IsReadOnly() bool {
|
||||
return r.isReadOnly
|
||||
}
|
||||
|
||||
// MarkAsReadOnly implements immutable interface.
|
||||
func (r *ro) MarkAsReadOnly() {
|
||||
r.isReadOnly = true
|
||||
}
|
||||
|
||||
// Immutable is an interface supported by compound types (Array, Map, Struct).
|
||||
type Immutable interface {
|
||||
IsReadOnly() bool
|
||||
MarkAsReadOnly()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue