Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SupunS/9f3c16a58bfdf036ce81bb9b225a5d03 to your computer and use it in GitHub Desktop.
Save SupunS/9f3c16a58bfdf036ce81bb9b225a5d03 to your computer and use it in GitHub Desktop.
commit de876037727966de86c508737632a5fa9ee750fd
Merge: 6713e43fc eecd39315
Author: Supun Setunga <supun.setunga@gmail.com>
Date: Fri Mar 15 15:49:05 2024 -0700
Merge branch 'master' of https://github.com/onflow/cadence into supun/atree-inlining-merge-master
diff --git a/go.mod b/go.mod
remerge CONFLICT (content): Merge conflict in go.mod
index fb60135c9..fb1d18a6c 100644
--- a/go.mod
+++ b/go.mod
@@ -13,11 +13,7 @@ require (
github.com/kr/pretty v0.3.1
github.com/leanovate/gopter v0.2.9
github.com/logrusorgru/aurora/v4 v4.0.0
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
github.com/onflow/atree v0.6.1-0.20240124211117-2fbf86010ae6
-=======
- github.com/onflow/atree v0.6.1-0.20240308163425-dc825c20b1a2
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
github.com/rivo/uniseg v0.4.4
github.com/schollz/progressbar/v3 v3.13.1
github.com/stretchr/testify v1.8.4
diff --git a/go.sum b/go.sum
remerge CONFLICT (content): Merge conflict in go.sum
index 02eff99bf..b7f708794 100644
--- a/go.sum
+++ b/go.sum
@@ -68,13 +68,8 @@ github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvr
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
github.com/onflow/atree v0.6.1-0.20240124211117-2fbf86010ae6 h1:FwSfDsR7ipLoL5Iq0TR5Oe7PwOftjbksodIoY1nx6bM=
github.com/onflow/atree v0.6.1-0.20240124211117-2fbf86010ae6/go.mod h1:7YNAyCd5JENq+NzH+fR1ABUZVzbSq9dkt0+5fZH3L2A=
-=======
-github.com/onflow/atree v0.6.1-0.20240308163425-dc825c20b1a2 h1:jJLDswfAVB0bHCu1y1FPdKukPcTNmN+jYEX9S9phbv0=
-github.com/onflow/atree v0.6.1-0.20240308163425-dc825c20b1a2/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
github.com/onflow/crypto v0.25.0 h1:BeWbLsh3ZD13Ej+Uky6kg1PL1ZIVBDVX+2MVBNwqddg=
github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
diff --git a/migrations/entitlements/migration.go b/migrations/entitlements/migration.go
remerge CONFLICT (content): Merge conflict in migrations/entitlements/migration.go
index 03cbe9b36..fc492a1e5 100644
--- a/migrations/entitlements/migration.go
+++ b/migrations/entitlements/migration.go
@@ -268,35 +268,9 @@ func ConvertValueToEntitlements(
case *interpreter.IDCapabilityValue:
borrowType := v.BorrowType
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- v.Iterate(
- inter,
- interpreter.EmptyLocationRange,
- func(key, value interpreter.Value) (resume bool) {
- values = append(values, key)
- values = append(values, value)
- return true
- },
- )
-
- return interpreter.NewDictionaryValueWithAddress(
- inter,
- interpreter.EmptyLocationRange,
- dictionaryStaticType,
- v.GetOwner(),
- values...,
- ), nil
-
- case *interpreter.CapabilityValue:
- semaType := inter.MustConvertStaticToSemaType(staticType)
- entitledType, converted := ConvertToEntitledType(semaType)
- if !converted {
- return nil, nil
-=======
entitledBorrowType, err := ConvertToEntitledType(inter, borrowType)
if err != nil {
return nil, err
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
}
if entitledBorrowType != nil {
diff --git a/migrations/migration.go b/migrations/migration.go
remerge CONFLICT (content): Merge conflict in migrations/migration.go
index 7e0e515ca..698a3bbed 100644
--- a/migrations/migration.go
+++ b/migrations/migration.go
@@ -249,7 +249,7 @@ func (m *StorageMigration) MigrateNestedValue(
)
interpreter.StoredValue(inter, existingStorable, m.storage).
- DeepRemove(inter)
+ DeepRemove(inter, false)
inter.RemoveReferencedSlab(existingStorable)
array.InsertWithoutTransfer(
@@ -308,24 +308,6 @@ func (m *StorageMigration) MigrateNestedValue(
// Read the keys first, so the iteration wouldn't be affected
// by the modification of the nested values.
var existingKeysAndValues []keyValuePair
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- dictionary.IterateReadOnly(
- m.interpreter,
- emptyLocationRange,
- func(key, value interpreter.Value) (resume bool) {
- existingKeysAndValues = append(
- existingKeysAndValues,
- keyValuePair{
- key: key,
- value: value,
- },
- )
-
- // continue iteration
- return true
- },
- )
-=======
iterator := dictionary.Iterator()
@@ -343,7 +325,6 @@ func (m *StorageMigration) MigrateNestedValue(
},
)
}
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
for _, existingKeyAndValue := range existingKeysAndValues {
existingKey := existingKeyAndValue.key
@@ -399,7 +380,7 @@ func (m *StorageMigration) MigrateNestedValue(
valueToSet = newValue
interpreter.StoredValue(inter, existingValueStorable, m.storage).
- DeepRemove(inter)
+ DeepRemove(inter, false)
inter.RemoveReferencedSlab(existingValueStorable)
}
diff --git a/migrations/statictypes/account_type_migration_test.go b/migrations/statictypes/account_type_migration_test.go
remerge CONFLICT (content): Merge conflict in migrations/statictypes/account_type_migration_test.go
index 90cbfd2e7..8c209408e 100644
--- a/migrations/statictypes/account_type_migration_test.go
+++ b/migrations/statictypes/account_type_migration_test.go
@@ -586,6 +586,8 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
fooAddressLocation := common.NewAddressLocation(nil, account, "Foo")
const fooBarQualifiedIdentifier = "Foo.Bar"
+ locationRange := interpreter.EmptyLocationRange
+
testCases := map[string]testCase{
"account_some_value": {
storedValue: func(_ *interpreter.Interpreter) interpreter.Value {
@@ -607,7 +609,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewArrayValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewVariableSizedStaticType(nil, interpreter.PrimitiveStaticTypeAnyStruct),
common.ZeroAddress,
stringTypeValue,
@@ -620,7 +622,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewArrayValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewVariableSizedStaticType(nil, interpreter.PrimitiveStaticTypeAnyStruct),
common.ZeroAddress,
stringTypeValue,
@@ -636,7 +638,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewArrayValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewVariableSizedStaticType(nil, interpreter.PrimitiveStaticTypeAnyStruct),
common.ZeroAddress,
stringTypeValue,
@@ -651,7 +653,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeInt8,
@@ -666,7 +668,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeInt8,
@@ -684,7 +686,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeInt8,
@@ -697,7 +699,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeInt8,
@@ -713,7 +715,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeMetaType,
@@ -731,7 +733,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeMetaType,
@@ -747,7 +749,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeMetaType,
@@ -765,7 +767,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeMetaType,
@@ -781,7 +783,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewCompositeValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
fooAddressLocation,
fooBarQualifiedIdentifier,
common.CompositeKindResource,
@@ -795,7 +797,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewCompositeValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
fooAddressLocation,
fooBarQualifiedIdentifier,
common.CompositeKindResource,
@@ -812,21 +814,7 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
// Store values
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- for name, testCase := range testCases {
- transferredValue := testCase.storedValue.Transfer(
- inter,
- locationRange,
- atree.Address(account),
- false,
- nil,
- nil,
- true, // storedValue is standalone
-
- )
-=======
test := func(name string, testCase testCase) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
t.Run(name, func(t *testing.T) {
t.Parallel()
@@ -847,11 +835,12 @@ func TestAccountTypeInNestedTypeValueMigration(t *testing.T) {
transferredValue := testCase.storedValue(inter).Transfer(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
atree.Address(account),
false,
nil,
nil,
+ true, // storedValue is standalone
)
inter.WriteStored(
@@ -921,12 +910,14 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
validateStorage bool
}
+ locationRange := interpreter.EmptyLocationRange
+
testCases := map[string]testCase{
"dictionary_value": {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeString,
@@ -937,7 +928,7 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeString,
@@ -952,7 +943,7 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewArrayValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewVariableSizedStaticType(
nil,
interpreter.PrimitiveStaticTypePublicAccount, //nolint:staticcheck
@@ -963,7 +954,7 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewArrayValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewVariableSizedStaticType(
nil,
unauthorizedAccountReferenceType,
@@ -1021,57 +1012,6 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
validateStorage: true,
},
"storage_capability_controller": {
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- storedValue: interpreter.NewUnmeteredStorageCapabilityControllerValue(
- interpreter.NewReferenceStaticType(
- nil,
- interpreter.UnauthorizedAccess,
- interpreter.PrimitiveStaticTypePublicAccount, //nolint:staticcheck,
- ),
- 1234,
- interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "v1"),
- ),
- expectedValue: interpreter.NewUnmeteredStorageCapabilityControllerValue(
- unauthorizedAccountReferenceType,
- 1234,
- interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "v1"),
- ),
- },
- }
-
- // Store values
-
- for name, testCase := range testCases {
- transferredValue := testCase.storedValue.Transfer(
- inter,
- locationRange,
- atree.Address(account),
- false,
- nil,
- nil,
- true, // storedValue is standalone
- )
-
- inter.WriteStored(
- account,
- pathDomain.Identifier(),
- interpreter.StringStorageMapKey(name),
- transferredValue,
- )
- }
-
- err = storage.Commit(inter, true)
- require.NoError(t, err)
-
- // Migrate
-
- migration := migrations.NewStorageMigration(inter, storage)
-
- migration.Migrate(
- &migrations.AddressSliceIterator{
- Addresses: []common.Address{
- account,
-=======
storedValue: func(_ *interpreter.Interpreter) interpreter.Value {
return interpreter.NewUnmeteredStorageCapabilityControllerValue(
interpreter.NewReferenceStaticType(
@@ -1082,7 +1022,6 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
1234,
interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "v1"),
)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
},
expectedValue: func(_ *interpreter.Interpreter) interpreter.Value {
return interpreter.NewUnmeteredStorageCapabilityControllerValue(
@@ -1138,7 +1077,7 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
storedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeString,
@@ -1159,7 +1098,7 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
expectedValue: func(inter *interpreter.Interpreter) interpreter.Value {
return interpreter.NewDictionaryValue(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
interpreter.NewDictionaryStaticType(
nil,
interpreter.PrimitiveStaticTypeString,
@@ -1205,11 +1144,12 @@ func TestMigratingValuesWithAccountStaticType(t *testing.T) {
transferredValue := testCase.storedValue(inter).Transfer(
inter,
- interpreter.EmptyLocationRange,
+ locationRange,
atree.Address(account),
false,
nil,
nil,
+ true, // storedValue is standalone
)
inter.WriteStored(
diff --git a/runtime/interpreter/interpreter.go b/runtime/interpreter/interpreter.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/interpreter.go
index f64adcaf1..34ba97919 100644
--- a/runtime/interpreter/interpreter.go
+++ b/runtime/interpreter/interpreter.go
@@ -5241,11 +5241,10 @@ func (interpreter *Interpreter) invalidateReferencedResources(
switch value := value.(type) {
case *CompositeValue:
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
value.ForEachLoadedField(
interpreter,
func(_ string, fieldValue Value) (resume bool) {
- interpreter.invalidateReferencedResources(fieldValue)
+ interpreter.invalidateReferencedResources(fieldValue, locationRange)
// continue iteration
return true
},
@@ -5256,45 +5255,23 @@ func (interpreter *Interpreter) invalidateReferencedResources(
value.IterateLoaded(
interpreter,
func(_, value Value) (resume bool) {
- interpreter.invalidateReferencedResources(value)
+ interpreter.invalidateReferencedResources(value, locationRange)
return true
},
)
valueID = value.ValueID()
-=======
- value.ForEachLoadedField(interpreter, func(_ string, fieldValue Value) (resume bool) {
- interpreter.invalidateReferencedResources(fieldValue, locationRange)
- // continue iteration
- return true
- })
- storageID = value.StorageID()
- case *DictionaryValue:
- value.IterateLoaded(interpreter, func(_, value Value) (resume bool) {
- interpreter.invalidateReferencedResources(value, locationRange)
- return true
- })
- storageID = value.StorageID()
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
case *ArrayValue:
value.IterateLoaded(
interpreter,
func(element Value) (resume bool) {
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- interpreter.invalidateReferencedResources(element)
- return true
- },
- )
- valueID = value.ValueID()
-
-=======
interpreter.invalidateReferencedResources(element, locationRange)
return true
},
locationRange,
)
- storageID = value.StorageID()
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+ valueID = value.ValueID()
+
case *SomeValue:
interpreter.invalidateReferencedResources(value.value, locationRange)
return
diff --git a/runtime/interpreter/interpreter_statement.go b/runtime/interpreter/interpreter_statement.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/interpreter_statement.go
index c43c713d0..3f869d13c 100644
--- a/runtime/interpreter/interpreter_statement.go
+++ b/runtime/interpreter/interpreter_statement.go
@@ -279,18 +279,6 @@ func (interpreter *Interpreter) VisitForStatement(statement *ast.ForStatement) (
}
value := interpreter.evalExpression(statement.Value)
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- transferredValue := value.Transfer(
- interpreter,
- locationRange,
- atree.Address{},
- false,
- nil,
- nil,
- true, // value is standalone
- )
-=======
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// Do not transfer the iterable value.
// Instead, transfer each iterating element.
diff --git a/runtime/interpreter/simplecompositevalue.go b/runtime/interpreter/simplecompositevalue.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/simplecompositevalue.go
index 3a2507e64..69e662845 100644
--- a/runtime/interpreter/simplecompositevalue.go
+++ b/runtime/interpreter/simplecompositevalue.go
@@ -71,11 +71,7 @@ func NewSimpleCompositeValue(
func (*SimpleCompositeValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *SimpleCompositeValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
-=======
func (v *SimpleCompositeValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
visitor.VisitSimpleCompositeValue(interpreter, v)
}
@@ -94,11 +90,7 @@ func (v *SimpleCompositeValue) ForEachField(
// Walk iterates over all field values of the composite value.
// It does NOT walk the computed fields and functions!
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *SimpleCompositeValue) Walk(_ *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
func (v *SimpleCompositeValue) Walk(_ *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
v.ForEachField(func(_ string, fieldValue Value) (resume bool) {
walkChild(fieldValue)
diff --git a/runtime/interpreter/value.go b/runtime/interpreter/value.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value.go
index 043ae433e..7aaadb691 100644
--- a/runtime/interpreter/value.go
+++ b/runtime/interpreter/value.go
@@ -108,13 +108,8 @@ type Value interface {
// NOTE: important, error messages rely on values to implement String
fmt.Stringer
isValue()
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- Accept(interpreter *Interpreter, locationRange LocationRange, visitor Visitor)
- Walk(interpreter *Interpreter, locationRange LocationRange, walkChild func(Value))
-=======
Accept(interpreter *Interpreter, visitor Visitor, locationRange LocationRange)
Walk(interpreter *Interpreter, walkChild func(Value), locationRange LocationRange)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
StaticType(interpreter *Interpreter) StaticType
// ConformsToStaticType returns true if the value (i.e. its dynamic type)
// conforms to its own static type.
@@ -347,19 +342,11 @@ func NewTypeValue(
func (TypeValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v TypeValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitTypeValue(interpreter, v)
-}
-
-func (TypeValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v TypeValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitTypeValue(interpreter, v)
}
func (TypeValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -564,19 +551,11 @@ var _ EquatableValue = VoidValue{}
func (VoidValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v VoidValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitVoidValue(interpreter, v)
-}
-
-func (VoidValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v VoidValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitVoidValue(interpreter, v)
}
func (VoidValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -682,19 +661,11 @@ func AsBoolValue(v bool) BoolValue {
func (BoolValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v BoolValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitBoolValue(interpreter, v)
-}
-
-func (BoolValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v BoolValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitBoolValue(interpreter, v)
}
func (BoolValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -892,19 +863,11 @@ var _ MemberAccessibleValue = CharacterValue{}
func (CharacterValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v CharacterValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitCharacterValue(interpreter, v)
-}
-
-func (CharacterValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v CharacterValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitCharacterValue(interpreter, v)
}
func (CharacterValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -1147,19 +1110,11 @@ func (v *StringValue) prepareGraphemes() {
func (*StringValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *StringValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitStringValue(interpreter, v)
-}
-
-func (*StringValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v *StringValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitStringValue(interpreter, v)
}
func (*StringValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -1725,6 +1680,7 @@ func (v *StringValue) ForEach(
false,
nil,
nil,
+ false, // value has a parent container because it is from iterator.
)
}
@@ -1938,29 +1894,18 @@ var _ IterableValue = &ArrayValue{}
func (*ArrayValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *ArrayValue) Accept(interpreter *Interpreter, locationRange LocationRange, visitor Visitor) {
-=======
func (v *ArrayValue) Accept(interpreter *Interpreter, visitor Visitor, locationRange LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
descend := visitor.VisitArrayValue(interpreter, v)
if !descend {
return
}
v.Walk(
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
interpreter,
- locationRange,
func(element Value) {
- element.Accept(interpreter, locationRange, visitor)
- },
-=======
- interpreter, func(element Value) {
element.Accept(interpreter, visitor, locationRange)
},
locationRange,
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
)
}
@@ -1979,10 +1924,6 @@ func (v *ArrayValue) Iterate(
)
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *ArrayValue) IterateLoaded(interpreter *Interpreter, f func(element Value) (resume bool)) {
- v.iterate(interpreter, v.array.IterateReadOnlyLoadedValues, f)
-=======
func (v *ArrayValue) IterateLoaded(
interpreter *Interpreter,
f func(element Value) (resume bool),
@@ -1992,12 +1933,11 @@ func (v *ArrayValue) IterateLoaded(
v.iterate(
interpreter,
- v.array.IterateLoadedValues,
+ v.array.IterateReadOnlyLoadedValues,
f,
transferElements,
locationRange,
)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
}
func (v *ArrayValue) iterate(
@@ -2022,6 +1962,7 @@ func (v *ArrayValue) iterate(
false,
nil,
nil,
+ false, // value has a parent container because it is from iterator.
)
}
@@ -2034,17 +1975,7 @@ func (v *ArrayValue) iterate(
}
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- if v.IsResourceKinded(interpreter) {
interpreter.withMutationPrevention(v.ValueID(), iterate)
- } else {
- iterate()
- }
-}
-
-func (v *ArrayValue) Walk(interpreter *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
- interpreter.withMutationPrevention(v.StorageID(), iterate)
}
func (v *ArrayValue) Walk(
@@ -2052,20 +1983,15 @@ func (v *ArrayValue) Walk(
walkChild func(Value),
locationRange LocationRange,
) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
v.Iterate(
interpreter,
func(element Value) (resume bool) {
walkChild(element)
return true
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- })
-=======
},
false,
locationRange,
)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
}
func (v *ArrayValue) StaticType(_ *Interpreter) StaticType {
@@ -2131,17 +2057,10 @@ func (v *ArrayValue) Destroy(interpreter *Interpreter, locationRange LocationRan
func() {
v.Walk(
interpreter,
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- locationRange,
- func(element Value) {
- maybeDestroy(interpreter, locationRange, element)
- },
-=======
func(element Value) {
maybeDestroy(interpreter, locationRange, element)
},
locationRange,
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
)
},
)
@@ -2392,17 +2311,10 @@ func (v *ArrayValue) Append(interpreter *Interpreter, locationRange LocationRang
func (v *ArrayValue) AppendAll(interpreter *Interpreter, locationRange LocationRange, other *ArrayValue) {
other.Walk(
interpreter,
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- locationRange,
- func(value Value) {
- v.Append(interpreter, locationRange, value)
- },
-=======
func(value Value) {
v.Append(interpreter, locationRange, value)
},
locationRange,
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
)
}
@@ -2411,19 +2323,13 @@ func (v *ArrayValue) InsertKey(interpreter *Interpreter, locationRange LocationR
v.Insert(interpreter, locationRange, index, value)
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *ArrayValue) Insert(interpreter *Interpreter, locationRange LocationRange, index int, element Value) {
-
- interpreter.validateMutation(v.ValueID(), locationRange)
-=======
func (v *ArrayValue) InsertWithoutTransfer(
interpreter *Interpreter,
locationRange LocationRange,
index int,
- element atree.Value,
+ element Value,
) {
- interpreter.validateMutation(v.StorageID(), locationRange)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+ interpreter.validateMutation(v.ValueID(), locationRange)
// We only need to check the lower bound before converting from `int` (signed) to `uint64` (unsigned).
// atree's Array.Insert function will check the upper bound and report an atree.IndexOutOfBoundsError
@@ -2446,30 +2352,12 @@ func (v *ArrayValue) InsertWithoutTransfer(
common.UseMemory(interpreter, metaDataSlabs)
common.UseMemory(interpreter, common.AtreeArrayElementOverhead)
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- interpreter.checkContainerMutation(v.Type.ElementType(), element, locationRange)
-
- element = element.Transfer(
- interpreter,
- locationRange,
- v.array.Address(),
- true,
- nil,
- map[atree.ValueID]struct{}{
- v.ValueID(): {},
- },
- true, // standalone element doesn't have a parent container yet.
- )
-
-=======
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
err := v.array.Insert(uint64(index), element)
if err != nil {
v.handleIndexOutOfBoundsError(err, index, locationRange)
panic(errors.NewExternalError(err))
}
-
interpreter.maybeValidateAtreeValue(v.array)
interpreter.maybeValidateAtreeStorage()
}
@@ -2478,8 +2366,8 @@ func (v *ArrayValue) Insert(interpreter *Interpreter, locationRange LocationRang
address := v.array.Address()
- preventTransfer := map[atree.StorageID]struct{}{
- v.StorageID(): {},
+ preventTransfer := map[atree.ValueID]struct{}{
+ v.ValueID(): {},
}
element = element.Transfer(
@@ -2489,6 +2377,7 @@ func (v *ArrayValue) Insert(interpreter *Interpreter, locationRange LocationRang
true,
nil,
preventTransfer,
+ true, // standalone element doesn't have a parent container yet.
)
interpreter.checkContainerMutation(v.Type.ElementType(), element, locationRange)
@@ -3944,19 +3833,11 @@ var _ MemberAccessibleValue = IntValue{}
func (IntValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v IntValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitIntValue(interpreter, v)
-}
-
-func (IntValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v IntValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitIntValue(interpreter, v)
}
func (IntValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -4514,19 +4395,11 @@ var _ HashableValue = Int8Value(0)
func (Int8Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Int8Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInt8Value(interpreter, v)
-}
-
-func (Int8Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Int8Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInt8Value(interpreter, v)
}
func (Int8Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -5164,19 +5037,11 @@ var _ MemberAccessibleValue = Int16Value(0)
func (Int16Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Int16Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInt16Value(interpreter, v)
-}
-
-func (Int16Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Int16Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInt16Value(interpreter, v)
}
func (Int16Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -5815,19 +5680,11 @@ var _ MemberAccessibleValue = Int32Value(0)
func (Int32Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Int32Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInt32Value(interpreter, v)
-}
-
-func (Int32Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Int32Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInt32Value(interpreter, v)
}
func (Int32Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -6464,19 +6321,11 @@ var _ MemberAccessibleValue = Int64Value(0)
func (Int64Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Int64Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInt64Value(interpreter, v)
-}
-
-func (Int64Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Int64Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInt64Value(interpreter, v)
}
func (Int64Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -7124,19 +6973,11 @@ var _ MemberAccessibleValue = Int128Value{}
func (Int128Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Int128Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInt128Value(interpreter, v)
-}
-
-func (Int128Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Int128Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInt128Value(interpreter, v)
}
func (Int128Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -7877,19 +7718,11 @@ var _ MemberAccessibleValue = Int256Value{}
func (Int256Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Int256Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInt256Value(interpreter, v)
-}
-
-func (Int256Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Int256Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInt256Value(interpreter, v)
}
func (Int256Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -8668,19 +8501,11 @@ var _ MemberAccessibleValue = UIntValue{}
func (UIntValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UIntValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUIntValue(interpreter, v)
-}
-
-func (UIntValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UIntValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUIntValue(interpreter, v)
}
func (UIntValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -9248,19 +9073,11 @@ func NewUnmeteredUInt8Value(value uint8) UInt8Value {
func (UInt8Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UInt8Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUInt8Value(interpreter, v)
-}
-
-func (UInt8Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UInt8Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUInt8Value(interpreter, v)
}
func (UInt8Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -9843,19 +9660,11 @@ func NewUnmeteredUInt16Value(value uint16) UInt16Value {
func (UInt16Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UInt16Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUInt16Value(interpreter, v)
-}
-
-func (UInt16Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UInt16Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUInt16Value(interpreter, v)
}
func (UInt16Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -10393,19 +10202,11 @@ var _ MemberAccessibleValue = UInt32Value(0)
func (UInt32Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UInt32Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUInt32Value(interpreter, v)
-}
-
-func (UInt32Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UInt32Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUInt32Value(interpreter, v)
}
func (UInt32Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -10950,19 +10751,11 @@ func NewUnmeteredUInt64Value(value uint64) UInt64Value {
func (UInt64Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UInt64Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUInt64Value(interpreter, v)
-}
-
-func (UInt64Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UInt64Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUInt64Value(interpreter, v)
}
func (UInt64Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -11541,19 +11334,11 @@ var _ MemberAccessibleValue = UInt128Value{}
func (UInt128Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UInt128Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUInt128Value(interpreter, v)
-}
-
-func (UInt128Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UInt128Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUInt128Value(interpreter, v)
}
func (UInt128Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -12225,19 +12010,11 @@ var _ MemberAccessibleValue = UInt256Value{}
func (UInt256Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UInt256Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUInt256Value(interpreter, v)
-}
-
-func (UInt256Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UInt256Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUInt256Value(interpreter, v)
}
func (UInt256Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -12893,19 +12670,11 @@ func NewUnmeteredWord8Value(value uint8) Word8Value {
func (Word8Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Word8Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitWord8Value(interpreter, v)
-}
-
-func (Word8Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Word8Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitWord8Value(interpreter, v)
}
func (Word8Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -13339,19 +13108,11 @@ func NewUnmeteredWord16Value(value uint16) Word16Value {
func (Word16Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Word16Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitWord16Value(interpreter, v)
-}
-
-func (Word16Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Word16Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitWord16Value(interpreter, v)
}
func (Word16Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -13786,19 +13547,11 @@ func NewUnmeteredWord32Value(value uint32) Word32Value {
func (Word32Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Word32Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitWord32Value(interpreter, v)
-}
-
-func (Word32Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Word32Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitWord32Value(interpreter, v)
}
func (Word32Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -14240,19 +13993,11 @@ var _ BigNumberValue = Word64Value(0)
func (Word64Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Word64Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitWord64Value(interpreter, v)
-}
-
-func (Word64Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Word64Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitWord64Value(interpreter, v)
}
func (Word64Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -14723,19 +14468,11 @@ var _ MemberAccessibleValue = Word128Value{}
func (Word128Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Word128Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitWord128Value(interpreter, v)
-}
-
-func (Word128Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Word128Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitWord128Value(interpreter, v)
}
func (Word128Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -15312,19 +15049,11 @@ var _ MemberAccessibleValue = Word256Value{}
func (Word256Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Word256Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitWord256Value(interpreter, v)
-}
-
-func (Word256Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Word256Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitWord256Value(interpreter, v)
}
func (Word256Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -15916,19 +15645,11 @@ var _ MemberAccessibleValue = Fix64Value(0)
func (Fix64Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v Fix64Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitFix64Value(interpreter, v)
-}
-
-func (Fix64Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v Fix64Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitFix64Value(interpreter, v)
}
func (Fix64Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -16496,19 +16217,11 @@ var _ MemberAccessibleValue = UFix64Value(0)
func (UFix64Value) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v UFix64Value) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitUFix64Value(interpreter, v)
-}
-
-func (UFix64Value) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v UFix64Value) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitUFix64Value(interpreter, v)
}
func (UFix64Value) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -17201,22 +16914,14 @@ var _ ContractValue = &CompositeValue{}
func (*CompositeValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *CompositeValue) Accept(interpreter *Interpreter, locationRange LocationRange, visitor Visitor) {
-=======
func (v *CompositeValue) Accept(interpreter *Interpreter, visitor Visitor, locationRange LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
descend := visitor.VisitCompositeValue(interpreter, v)
if !descend {
return
}
v.ForEachField(interpreter, func(_ string, value Value) (resume bool) {
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- value.Accept(interpreter, locationRange, visitor)
-=======
value.Accept(interpreter, visitor, locationRange)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// continue iteration
return true
@@ -17225,11 +16930,7 @@ func (v *CompositeValue) Accept(interpreter *Interpreter, visitor Visitor, locat
// Walk iterates over all field values of the composite value.
// It does NOT walk the computed field or functions!
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *CompositeValue) Walk(interpreter *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
func (v *CompositeValue) Walk(interpreter *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
v.ForEachField(interpreter, func(_ string, value Value) (resume bool) {
walkChild(value)
@@ -17679,23 +17380,6 @@ func (v *CompositeValue) SetMemberWithoutTransfer(
}()
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- address := v.StorageAddress()
-
- value = value.Transfer(
- interpreter,
- locationRange,
- address,
- true,
- nil,
- map[atree.ValueID]struct{}{
- v.ValueID(): {},
- },
- true, // value is standalone before being set in parent container.
- )
-
-=======
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
existingStorable, err := v.dictionary.Set(
StringAtreeValueComparator,
StringAtreeValueHashInput,
@@ -17735,9 +17419,10 @@ func (v *CompositeValue) SetMember(
address,
true,
nil,
- map[atree.StorageID]struct{}{
- v.StorageID(): {},
+ map[atree.ValueID]struct{}{
+ v.ValueID(): {},
},
+ true, // value is standalone before being set in parent container.
)
return v.SetMemberWithoutTransfer(
@@ -18692,13 +18377,6 @@ func attachmentBaseAndSelfValues(
return
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *CompositeValue) forEachAttachment(interpreter *Interpreter, locationRange LocationRange, f func(*CompositeValue)) {
- iterator, err := v.dictionary.Iterator(
- StringAtreeValueComparator,
- StringAtreeValueHashInput,
- )
-=======
func (v *CompositeValue) forEachAttachment(
interpreter *Interpreter,
locationRange LocationRange,
@@ -18724,8 +18402,10 @@ func forEachAttachment(
panic(errors.NewUnreachableError())
}
- iterator, err := composite.dictionary.Iterator()
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+ iterator, err := composite.dictionary.Iterator(
+ StringAtreeValueComparator,
+ StringAtreeValueHashInput,
+ )
if err != nil {
panic(errors.NewExternalError(err))
}
@@ -18859,6 +18539,7 @@ func (v *CompositeValue) ForEach(
false,
nil,
nil,
+ false, // value has a parent container because it is from iterator.
)
}
@@ -19151,33 +18832,18 @@ var _ ReferenceTrackedResourceKindedValue = &DictionaryValue{}
func (*DictionaryValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *DictionaryValue) Accept(
- interpreter *Interpreter,
- locationRange LocationRange,
- visitor Visitor,
-) {
-=======
func (v *DictionaryValue) Accept(interpreter *Interpreter, visitor Visitor, locationRange LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
descend := visitor.VisitDictionaryValue(interpreter, v)
if !descend {
return
}
v.Walk(
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
interpreter,
- locationRange,
func(value Value) {
- value.Accept(interpreter, locationRange, visitor)
- },
-=======
- interpreter, func(value Value) {
value.Accept(interpreter, visitor, locationRange)
},
locationRange,
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
)
}
@@ -19218,16 +18884,8 @@ func (v *DictionaryValue) iterateKeys(
panic(errors.NewExternalError(err))
}
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- if v.IsResourceKinded(interpreter) {
- interpreter.withMutationPrevention(v.ValueID(), iterate)
- } else {
- iterate()
- }
-=======
- interpreter.withMutationPrevention(v.StorageID(), iterate)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+ interpreter.withMutationPrevention(v.ValueID(), iterate)
}
func (v *DictionaryValue) IterateReadOnly(
@@ -19291,27 +18949,15 @@ func (v *DictionaryValue) iterate(
panic(errors.NewExternalError(err))
}
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- if v.IsResourceKinded(interpreter) {
- interpreter.withMutationPrevention(v.ValueID(), iterate)
- } else {
- iterate()
- }
-=======
- interpreter.withMutationPrevention(v.StorageID(), iterate)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+ interpreter.withMutationPrevention(v.ValueID(), iterate)
}
type DictionaryKeyIterator struct {
mapIterator atree.MapIterator
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (i DictionaryKeyIterator) NextKey(gauge common.MemoryGauge) Value {
-=======
-func (i DictionaryIterator) NextKeyUnconverted() atree.Value {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+func (i DictionaryKeyIterator) NextKeyUnconverted() atree.Value {
atreeValue, err := i.mapIterator.NextKey()
if err != nil {
panic(errors.NewExternalError(err))
@@ -19319,7 +18965,7 @@ func (i DictionaryIterator) NextKeyUnconverted() atree.Value {
return atreeValue
}
-func (i DictionaryIterator) NextKey(gauge common.MemoryGauge) Value {
+func (i DictionaryKeyIterator) NextKey(gauge common.MemoryGauge) Value {
atreeValue := i.NextKeyUnconverted()
if atreeValue == nil {
return nil
@@ -19327,12 +18973,7 @@ func (i DictionaryIterator) NextKey(gauge common.MemoryGauge) Value {
return MustConvertStoredValue(gauge, atreeValue)
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *DictionaryValue) Iterator() DictionaryKeyIterator {
-
- mapIterator, err := v.dictionary.ReadOnlyIterator()
-=======
-func (i DictionaryIterator) Next(gauge common.MemoryGauge) (Value, Value) {
+func (i DictionaryKeyIterator) Next(gauge common.MemoryGauge) (Value, Value) {
atreeKeyValue, atreeValue, err := i.mapIterator.Next()
if err != nil {
panic(errors.NewExternalError(err))
@@ -19344,9 +18985,8 @@ func (i DictionaryIterator) Next(gauge common.MemoryGauge) (Value, Value) {
MustConvertStoredValue(gauge, atreeValue)
}
-func (v *DictionaryValue) Iterator() DictionaryIterator {
- mapIterator, err := v.dictionary.Iterator()
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
+func (v *DictionaryValue) Iterator() DictionaryKeyIterator {
+ mapIterator, err := v.dictionary.ReadOnlyIterator()
if err != nil {
panic(errors.NewExternalError(err))
}
@@ -19356,12 +18996,7 @@ func (v *DictionaryValue) Iterator() DictionaryIterator {
}
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *DictionaryValue) Walk(
- interpreter *Interpreter,
- locationRange LocationRange,
- walkChild func(Value),
-) {
+func (v *DictionaryValue) Walk(interpreter *Interpreter, walkChild func(Value), locationRange LocationRange) {
v.Iterate(
interpreter,
locationRange,
@@ -19371,14 +19006,6 @@ func (v *DictionaryValue) Walk(
return true
},
)
-=======
-func (v *DictionaryValue) Walk(interpreter *Interpreter, walkChild func(Value), _ LocationRange) {
- v.Iterate(interpreter, func(key, value Value) (resume bool) {
- walkChild(key)
- walkChild(value)
- return true
- })
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
}
func (v *DictionaryValue) StaticType(_ *Interpreter) StaticType {
@@ -19388,28 +19015,20 @@ func (v *DictionaryValue) StaticType(_ *Interpreter) StaticType {
func (v *DictionaryValue) IsImportable(inter *Interpreter, locationRange LocationRange) bool {
importable := true
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
v.Iterate(
inter,
- EmptyLocationRange,
+ locationRange,
func(key, value Value) (resume bool) {
- if !key.IsImportable(inter) || !value.IsImportable(inter) {
- importable = false
- // stop iteration
- return false
- }
-=======
- v.Iterate(inter, func(key, value Value) (resume bool) {
if !key.IsImportable(inter, locationRange) || !value.IsImportable(inter, locationRange) {
importable = false
// stop iteration
return false
}
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// continue iteration
return true
- })
+ },
+ )
return importable
}
@@ -19513,15 +19132,7 @@ func (v *DictionaryValue) ForEachKey(
}
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- if v.IsResourceKinded(interpreter) {
interpreter.withMutationPrevention(v.ValueID(), iterate)
- } else {
- iterate()
- }
-=======
- interpreter.withMutationPrevention(v.StorageID(), iterate)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
}
func (v *DictionaryValue) ContainsKey(
@@ -19965,7 +19576,9 @@ func (v *DictionaryValue) InsertWithoutTransfer(
if err != nil {
panic(errors.NewExternalError(err))
}
+
interpreter.maybeValidateAtreeValue(v.dictionary)
+ interpreter.maybeValidateAtreeStorage()
return existingValueStorable
}
@@ -20005,24 +19618,7 @@ func (v *DictionaryValue) Insert(
interpreter.checkContainerMutation(v.Type.KeyType, keyValue, locationRange)
interpreter.checkContainerMutation(v.Type.ValueType, value, locationRange)
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- // atree only calls Storable() on keyValue if needed,
- // i.e., if the key is a new key
- existingValueStorable, err := v.dictionary.Set(
- valueComparator,
- hashInputProvider,
- keyValue,
- value,
- )
- if err != nil {
- panic(errors.NewExternalError(err))
- }
-
- interpreter.maybeValidateAtreeValue(v.dictionary)
- interpreter.maybeValidateAtreeStorage()
-=======
existingValueStorable := v.InsertWithoutTransfer(interpreter, locationRange, keyValue, value)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
if existingValueStorable == nil {
return NilOptionalValue
@@ -20534,19 +20130,11 @@ var _ OptionalValue = NilValue{}
func (NilValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v NilValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitNilValue(interpreter, v)
-}
-
-func (NilValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v NilValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitNilValue(interpreter, v)
}
func (NilValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -20712,26 +20300,15 @@ var _ OptionalValue = &SomeValue{}
func (*SomeValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *SomeValue) Accept(interpreter *Interpreter, locationRange LocationRange, visitor Visitor) {
-=======
func (v *SomeValue) Accept(interpreter *Interpreter, visitor Visitor, locationRange LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
descend := visitor.VisitSomeValue(interpreter, v)
if !descend {
return
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- v.value.Accept(interpreter, locationRange, visitor)
-}
-
-func (v *SomeValue) Walk(_ *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
v.value.Accept(interpreter, visitor, locationRange)
}
func (v *SomeValue) Walk(_ *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
walkChild(v.value)
}
@@ -21184,19 +20761,11 @@ func NewStorageReferenceValue(
func (*StorageReferenceValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *StorageReferenceValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitStorageReferenceValue(interpreter, v)
-}
-
-func (*StorageReferenceValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v *StorageReferenceValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitStorageReferenceValue(interpreter, v)
}
func (*StorageReferenceValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
// NOTE: *not* walking referenced value!
}
@@ -21633,19 +21202,11 @@ func NewEphemeralReferenceValue(
func (*EphemeralReferenceValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *EphemeralReferenceValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitEphemeralReferenceValue(interpreter, v)
-}
-
-func (*EphemeralReferenceValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v *EphemeralReferenceValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitEphemeralReferenceValue(interpreter, v)
}
func (*EphemeralReferenceValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
// NOTE: *not* walking referenced value!
}
@@ -21976,19 +21537,11 @@ var _ MemberAccessibleValue = AddressValue{}
func (AddressValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v AddressValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitAddressValue(interpreter, v)
-}
-
-func (AddressValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v AddressValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitAddressValue(interpreter, v)
}
func (AddressValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -22216,19 +21769,11 @@ var _ MemberAccessibleValue = PathValue{}
func (PathValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v PathValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitPathValue(interpreter, v)
-}
-
-func (PathValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v PathValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitPathValue(interpreter, v)
}
func (PathValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -22474,11 +22019,7 @@ var _ EquatableValue = &PublishedValue{}
func (*PublishedValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *PublishedValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
-=======
func (v *PublishedValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
visitor.VisitPublishedValue(interpreter, v)
}
@@ -22514,11 +22055,7 @@ func (v *PublishedValue) MeteredString(memoryGauge common.MemoryGauge, seenRefer
)
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *PublishedValue) Walk(_ *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
func (v *PublishedValue) Walk(_ *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
walkChild(v.Recipient)
walkChild(v.Value)
}
@@ -22578,12 +22115,8 @@ func (v *PublishedValue) Transfer(
remove,
nil,
preventTransfer,
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
hasNoParentContainer,
- ).(*CapabilityValue)
-=======
).(*IDCapabilityValue)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
addressValue := v.Recipient.Transfer(
interpreter,
diff --git a/runtime/interpreter/value_accountcapabilitycontroller.go b/runtime/interpreter/value_accountcapabilitycontroller.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_accountcapabilitycontroller.go
index 522de12d6..4e4de537b 100644
--- a/runtime/interpreter/value_accountcapabilitycontroller.go
+++ b/runtime/interpreter/value_accountcapabilitycontroller.go
@@ -88,19 +88,11 @@ func (v *AccountCapabilityControllerValue) CapabilityControllerBorrowType() *Ref
return v.BorrowType
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *AccountCapabilityControllerValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitAccountCapabilityControllerValue(interpreter, v)
-}
-
-func (v *AccountCapabilityControllerValue) Walk(_ *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
func (v *AccountCapabilityControllerValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitAccountCapabilityControllerValue(interpreter, v)
}
func (v *AccountCapabilityControllerValue) Walk(_ *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
walkChild(v.CapabilityID)
}
diff --git a/runtime/interpreter/value_capability.go b/runtime/interpreter/value_capability.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_capability.go
index 7bce2eea9..947150015 100644
--- a/runtime/interpreter/value_capability.go
+++ b/runtime/interpreter/value_capability.go
@@ -75,13 +75,6 @@ var _ CapabilityValue = &IDCapabilityValue{}
func (*IDCapabilityValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *CapabilityValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitCapabilityValue(interpreter, v)
-}
-
-func (v *CapabilityValue) Walk(_ *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
func (*IDCapabilityValue) isCapabilityValue() {}
func (v *IDCapabilityValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
@@ -89,7 +82,6 @@ func (v *IDCapabilityValue) Accept(interpreter *Interpreter, visitor Visitor, _
}
func (v *IDCapabilityValue) Walk(_ *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
walkChild(v.ID)
walkChild(v.Address)
}
@@ -227,13 +219,8 @@ func (v *IDCapabilityValue) Clone(interpreter *Interpreter) Value {
)
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *CapabilityValue) DeepRemove(interpreter *Interpreter, _ bool) {
+func (v *IDCapabilityValue) DeepRemove(interpreter *Interpreter, _ bool) {
v.Address.DeepRemove(interpreter, false)
-=======
-func (v *IDCapabilityValue) DeepRemove(interpreter *Interpreter) {
- v.Address.DeepRemove(interpreter)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
}
func (v *IDCapabilityValue) ByteSize() uint32 {
diff --git a/runtime/interpreter/value_function.go b/runtime/interpreter/value_function.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_function.go
index b0e0f2fd6..f4605f9f2 100644
--- a/runtime/interpreter/value_function.go
+++ b/runtime/interpreter/value_function.go
@@ -95,19 +95,11 @@ func (f *InterpretedFunctionValue) MeteredString(memoryGauge common.MemoryGauge,
return f.String()
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (f *InterpretedFunctionValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitInterpretedFunctionValue(interpreter, f)
-}
-
-func (f *InterpretedFunctionValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (f *InterpretedFunctionValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitInterpretedFunctionValue(interpreter, f)
}
func (f *InterpretedFunctionValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -234,19 +226,11 @@ var _ ContractValue = &HostFunctionValue{}
func (*HostFunctionValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (f *HostFunctionValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitHostFunctionValue(interpreter, f)
-}
-
-func (f *HostFunctionValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (f *HostFunctionValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitHostFunctionValue(interpreter, f)
}
func (f *HostFunctionValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
@@ -396,19 +380,11 @@ func (f BoundFunctionValue) MeteredString(memoryGauge common.MemoryGauge, seenRe
return f.Function.MeteredString(memoryGauge, seenReferences)
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (f BoundFunctionValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitBoundFunctionValue(interpreter, f)
-}
-
-func (f BoundFunctionValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (f BoundFunctionValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitBoundFunctionValue(interpreter, f)
}
func (f BoundFunctionValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
diff --git a/runtime/interpreter/value_link.go b/runtime/interpreter/value_link.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_link.go
index 76925dbe5..3a8188162 100644
--- a/runtime/interpreter/value_link.go
+++ b/runtime/interpreter/value_link.go
@@ -52,19 +52,11 @@ func (PathLinkValue) isValue() {}
func (PathLinkValue) isLinkValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v PathLinkValue) Accept(_ *Interpreter, _ LocationRange, _ Visitor) {
- panic(errors.NewUnreachableError())
-}
-
-func (v PathLinkValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v PathLinkValue) Accept(_ *Interpreter, _ Visitor, _ LocationRange) {
panic(errors.NewUnreachableError())
}
func (v PathLinkValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
panic(errors.NewUnreachableError())
}
@@ -185,19 +177,11 @@ func (AccountLinkValue) isValue() {}
func (AccountLinkValue) isLinkValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v AccountLinkValue) Accept(_ *Interpreter, _ LocationRange, _ Visitor) {
- panic(errors.NewUnreachableError())
-}
-
-func (AccountLinkValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (v AccountLinkValue) Accept(_ *Interpreter, _ Visitor, _ LocationRange) {
panic(errors.NewUnreachableError())
}
func (AccountLinkValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
panic(errors.NewUnreachableError())
}
diff --git a/runtime/interpreter/value_pathcapability.go b/runtime/interpreter/value_pathcapability.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_pathcapability.go
index 77db00254..6e5c8357f 100644
--- a/runtime/interpreter/value_pathcapability.go
+++ b/runtime/interpreter/value_pathcapability.go
@@ -44,13 +44,6 @@ var _ CapabilityValue = &PathCapabilityValue{}
func (*PathCapabilityValue) isValue() {}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *PathCapabilityValue) Accept(_ *Interpreter, _ LocationRange, _ Visitor) {
- panic(errors.NewUnreachableError())
-}
-
-func (v *PathCapabilityValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (*PathCapabilityValue) isCapabilityValue() {}
func (v *PathCapabilityValue) Accept(_ *Interpreter, _ Visitor, _ LocationRange) {
@@ -58,7 +51,6 @@ func (v *PathCapabilityValue) Accept(_ *Interpreter, _ Visitor, _ LocationRange)
}
func (v *PathCapabilityValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
panic(errors.NewUnreachableError())
}
diff --git a/runtime/interpreter/value_placeholder.go b/runtime/interpreter/value_placeholder.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_placeholder.go
index 8e98cf02f..955b641a8 100644
--- a/runtime/interpreter/value_placeholder.go
+++ b/runtime/interpreter/value_placeholder.go
@@ -45,19 +45,11 @@ func (f placeholderValue) MeteredString(_ common.MemoryGauge, _ SeenReferences)
return ""
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (f placeholderValue) Accept(_ *Interpreter, _ LocationRange, _ Visitor) {
- // NO-OP
-}
-
-func (f placeholderValue) Walk(_ *Interpreter, _ LocationRange, _ func(Value)) {
-=======
func (f placeholderValue) Accept(_ *Interpreter, _ Visitor, _ LocationRange) {
// NO-OP
}
func (f placeholderValue) Walk(_ *Interpreter, _ func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
// NO-OP
}
diff --git a/runtime/interpreter/value_storagecapabilitycontroller.go b/runtime/interpreter/value_storagecapabilitycontroller.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_storagecapabilitycontroller.go
index afea3b724..4dd367e8c 100644
--- a/runtime/interpreter/value_storagecapabilitycontroller.go
+++ b/runtime/interpreter/value_storagecapabilitycontroller.go
@@ -109,19 +109,11 @@ func (v *StorageCapabilityControllerValue) CapabilityControllerBorrowType() *Ref
return v.BorrowType
}
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
-func (v *StorageCapabilityControllerValue) Accept(interpreter *Interpreter, _ LocationRange, visitor Visitor) {
- visitor.VisitStorageCapabilityControllerValue(interpreter, v)
-}
-
-func (v *StorageCapabilityControllerValue) Walk(_ *Interpreter, _ LocationRange, walkChild func(Value)) {
-=======
func (v *StorageCapabilityControllerValue) Accept(interpreter *Interpreter, visitor Visitor, _ LocationRange) {
visitor.VisitStorageCapabilityControllerValue(interpreter, v)
}
func (v *StorageCapabilityControllerValue) Walk(_ *Interpreter, walkChild func(Value), _ LocationRange) {
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
walkChild(v.TargetPath)
walkChild(v.CapabilityID)
}
diff --git a/runtime/interpreter/value_test.go b/runtime/interpreter/value_test.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/value_test.go
index 00696e0bd..5e1fa4a7d 100644
--- a/runtime/interpreter/value_test.go
+++ b/runtime/interpreter/value_test.go
@@ -1212,11 +1212,7 @@ func TestVisitor(t *testing.T) {
common.ZeroAddress,
)
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- value.Accept(inter, EmptyLocationRange, visitor)
-=======
value.Accept(inter, visitor, EmptyLocationRange)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
require.Equal(t, 1, intVisits)
require.Equal(t, 1, stringVisits)
diff --git a/runtime/interpreter/walk.go b/runtime/interpreter/walk.go
remerge CONFLICT (content): Merge conflict in runtime/interpreter/walk.go
index 9c9e5ed30..72271a228 100644
--- a/runtime/interpreter/walk.go
+++ b/runtime/interpreter/walk.go
@@ -39,12 +39,6 @@ func WalkValue(interpreter *Interpreter, walker ValueWalker, value Value, locati
value.Walk(
interpreter,
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
- EmptyLocationRange,
- func(child Value) {
- WalkValue(interpreter, walker, child)
- },
-=======
func(child Value) {
WalkValue(
interpreter,
@@ -54,7 +48,6 @@ func WalkValue(interpreter *Interpreter, walker ValueWalker, value Value, locati
)
},
locationRange,
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
)
walker.WalkValue(interpreter, nil)
diff --git a/runtime/stdlib/account.go b/runtime/stdlib/account.go
remerge CONFLICT (content): Merge conflict in runtime/stdlib/account.go
index a2e768b8f..1778d99a7 100644
--- a/runtime/stdlib/account.go
+++ b/runtime/stdlib/account.go
@@ -3330,12 +3330,8 @@ func newAccountCapabilitiesPublishFunction(
true,
nil,
nil,
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
true, // capabilityValue is standalone because it is from invocation.Arguments[0].
- ).(*interpreter.CapabilityValue)
-=======
).(*interpreter.IDCapabilityValue)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
if !ok {
panic(errors.NewUnreachableError())
}
@@ -3402,12 +3398,8 @@ func newAccountCapabilitiesUnpublishFunction(
true,
nil,
nil,
-<<<<<<< 6713e43fc (adjust test to new reference-to-resource semantics of Cadence 1.0)
false, // capabilityValue is an element of storage map.
- ).(*interpreter.CapabilityValue)
-=======
).(*interpreter.IDCapabilityValue)
->>>>>>> eecd39315 (Merge pull request #3174 from onflow/release/v1.0.0-preview.14)
if !ok {
panic(errors.NewUnreachableError())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment