Skip to content

Commit

Permalink
added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
deelawn committed Sep 21, 2024
1 parent 8fe3b37 commit 26e8529
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gnovm/pkg/gnolang/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,11 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node {
// Replace const index with int *ConstExpr,
// or if not const, assert integer type..
checkOrConvertIntegerKind(store, last, n.Index)

// Addressability of this index expression can only be known for slice and
// strings, explanations below in the respective blocks. If this is an index
// on an array, do nothing. This will defer to the array's addresability when
// the `addressability` method is called on this index expression.
if dt.Kind() == SliceKind {
// A value at a slice index is always addressable because the underlying
// array is addressable.
Expand Down Expand Up @@ -2396,7 +2401,7 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node {
// We need to replace all references of the new
// Type with old Type, including in attributes.
n.Type.SetAttribute(ATTR_TYPE_VALUE, dst)
// Replace the type with *constTypeExpr{},
// Replace the type with *{},
// otherwise methods would be un at runtime.
n.Type = constType(n.Type, dst)

Expand Down

0 comments on commit 26e8529

Please sign in to comment.