Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate Cadence composite Storable() to Atree #2621

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions runtime/interpreter/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -2540,8 +2540,12 @@ func (v *ArrayValue) Equal(interpreter *Interpreter, locationRange LocationRange
return true
}

func (v *ArrayValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint64) (atree.Storable, error) {
return atree.StorageIDStorable(v.StorageID()), nil
func (v *ArrayValue) Storable(
storage atree.SlabStorage,
address atree.Address,
maxInlineSize uint64,
) (atree.Storable, error) {
return v.array.Storable(storage, address, maxInlineSize)
}

func (v *ArrayValue) IsReferenceTrackedResourceKindedValue() {}
Expand Down Expand Up @@ -16022,12 +16026,16 @@ func (v *CompositeValue) IsStorable() bool {
return v.Location != nil
}

func (v *CompositeValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint64) (atree.Storable, error) {
func (v *CompositeValue) Storable(
storage atree.SlabStorage,
address atree.Address,
maxInlineSize uint64,
) (atree.Storable, error) {
if !v.IsStorable() {
return NonStorable{Value: v}, nil
}

return atree.StorageIDStorable(v.StorageID()), nil
return v.dictionary.Storable(storage, address, maxInlineSize)
}

func (v *CompositeValue) NeedsStoreTo(address atree.Address) bool {
Expand Down Expand Up @@ -17533,8 +17541,12 @@ func (v *DictionaryValue) Equal(interpreter *Interpreter, locationRange Location
}
}

func (v *DictionaryValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint64) (atree.Storable, error) {
return atree.StorageIDStorable(v.StorageID()), nil
func (v *DictionaryValue) Storable(
storage atree.SlabStorage,
address atree.Address,
maxInlineSize uint64,
) (atree.Storable, error) {
return v.dictionary.Storable(storage, address, maxInlineSize)
}

func (v *DictionaryValue) IsReferenceTrackedResourceKindedValue() {}
Expand Down