Skip to content

Commit

Permalink
Rename atRoot param for Transfer() and DeepRemove()
Browse files Browse the repository at this point in the history
- Renamed atRoot param to hasNoParentContainer for Transfer() and
  DeepRemove()
- Added comments for each instances of hasNoParentContainer for
  Transfer()
- For SomeValue.Transfer() and PublishedValue.Transfer(), use
  received hasNoParentContainer argument as inner value's
  Transfer() parameter
  • Loading branch information
fxamacker committed Nov 21, 2023
1 parent d35b7d6 commit 7ddc21d
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 72 deletions.
6 changes: 3 additions & 3 deletions runtime/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ func (interpreter *Interpreter) transferAndConvert(
false,
nil,
nil,
true,
true, // value is standalone.
)

result := interpreter.ConvertAndBox(
Expand Down Expand Up @@ -3925,7 +3925,7 @@ func (interpreter *Interpreter) authAccountSaveFunction(addressValue AddressValu
true,
nil,
nil,
true,
true, // value is standalone because it is from invocation.Arguments[0].
)

// Write new value
Expand Down Expand Up @@ -4050,7 +4050,7 @@ func (interpreter *Interpreter) authAccountReadFunction(addressValue AddressValu
false,
nil,
nil,
false,
false, // value is an element in storage map because it is from "ReadStored".
)

// Remove the value from storage,
Expand Down
2 changes: 1 addition & 1 deletion runtime/interpreter/interpreter_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ func (interpreter *Interpreter) VisitAttachExpression(attachExpression *ast.Atta
false,
nil,
nil,
true,
true, // base is standalone.
).(*CompositeValue)

// we enforce this in the checker
Expand Down
2 changes: 1 addition & 1 deletion runtime/interpreter/interpreter_invocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (interpreter *Interpreter) invokeFunctionValue(
false,
nil,
nil,
true,
true, // argument is standalone.
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/interpreter/interpreter_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (interpreter *Interpreter) VisitForStatement(statement *ast.ForStatement) S
false,
nil,
nil,
true,
true, // value is standalone
)

iterable, ok := transferredValue.(IterableValue)
Expand Down
2 changes: 1 addition & 1 deletion runtime/interpreter/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ func TestNestedContainerMutationAfterMove(t *testing.T) {
false,
nil,
map[atree.ValueID]struct{}{},
true,
true, // childValue1 is standalone before being inserted into containerValue1.
).(*CompositeValue)

containerValue1.Append(inter, EmptyLocationRange, childValue1)
Expand Down
Loading

0 comments on commit 7ddc21d

Please sign in to comment.