Skip to content

Commit

Permalink
Implement 'RemoveMember' for SimpleCompositeValue
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Nov 9, 2023
1 parent 13ac8b2 commit ab5a032
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/interpreter/simplecompositevalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/onflow/atree"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/format"
"github.com/onflow/cadence/runtime/sema"
)
Expand Down Expand Up @@ -147,9 +146,10 @@ func (v *SimpleCompositeValue) GetMember(
return nil
}

func (*SimpleCompositeValue) RemoveMember(_ *Interpreter, _ LocationRange, _ string) Value {
// Simple composite values have no removable members (fields / functions)
panic(errors.NewUnreachableError())
func (v *SimpleCompositeValue) RemoveMember(_ *Interpreter, _ LocationRange, name string) Value {
value := v.Fields[name]
delete(v.Fields, name)
return value
}

func (v *SimpleCompositeValue) SetMember(_ *Interpreter, _ LocationRange, name string, value Value) bool {
Expand Down

0 comments on commit ab5a032

Please sign in to comment.