[Sol->Yul] Implementing read from storage for array types.

This commit is contained in:
Djordje Mijovic 2020-12-10 12:03:39 +01:00
parent 052b97e217
commit b54273e37e
2 changed files with 7 additions and 1 deletions

View File

@ -2203,6 +2203,11 @@ string YulUtilFunctions::readFromStorageValueType(Type const& _type, optional<si
string YulUtilFunctions::readFromStorageReferenceType(Type const& _type)
{
if (auto const* arrayType = dynamic_cast<ArrayType const*>(&_type))
return copyArrayFromStorageToMemoryFunction(
dynamic_cast<ArrayType const&>(*arrayType->copyForLocation(DataLocation::Storage, false)),
*arrayType
);
solUnimplementedAssert(_type.category() == Type::Category::Struct, "");
string functionName = "read_from_storage_reference_type_" + _type.identifier();

View File

@ -49,7 +49,8 @@ contract Test {
a = s.a[1];
}
}
// ====
// compileViaYul: also
// ----
// testInit() -> 0, 0, 0, 0, true
// testCopyRead() -> 1, 2, 3, 4