My question concerns this code:
|
/// Reference to storage, first bool is true for immutables |
|
StorageRef(bool, Box<Type>), |
In Solidity, an array, mapping, or struct is entirely in memory or entirely in storage.
One cannot, for example, have an in-memory array of in-storage arrays.
However, the above Type::StorageRef allows for such combinations.
Were any alternatives considered, e.g., a flag or enum to indicate where a value is stored?
EDIT: This issue seems related: #933
EDIT 2: This program provides an example of the problem: https://github.com/ethereum/solidity/blob/7e67811a82d55bb280f5a21e9b623e4c3d99fbca/test/libsolidity/semanticTests/events/event_indexed_string.sol
The cast on this line 7 performs a storage load and a cast of the resulting, in-memory value:
|
return Expression::StorageLoad { |
|
loc: *loc, |
|
ty: *r, |
|
expr: Box::new(self.clone()), |
|
} |
|
.cast(loc, to, implicit, ns, diagnostics); |
Thus, the pushes are performed to the in-memory value only, and storage is not modified.
My question concerns this code:
solang/src/sema/ast.rs
Lines 48 to 49 in 53202f8
In Solidity, an array, mapping, or struct is entirely in memory or entirely in storage.
One cannot, for example, have an in-memory array of in-storage arrays.
However, the above
Type::StorageRefallows for such combinations.Were any alternatives considered, e.g., a flag or enum to indicate where a value is stored?
EDIT: This issue seems related: #933
EDIT 2: This program provides an example of the problem: https://github.com/ethereum/solidity/blob/7e67811a82d55bb280f5a21e9b623e4c3d99fbca/test/libsolidity/semanticTests/events/event_indexed_string.sol
The cast on this line 7 performs a storage load and a cast of the resulting, in-memory value:
solang/src/sema/expression/mod.rs
Lines 179 to 184 in 53202f8
Thus, the pushes are performed to the in-memory value only, and storage is not modified.