| 2794 | } |
| 2795 | |
| 2796 | std::string YulUtilFunctions::readFromStorageDynamic( |
| 2797 | Type const& _type, |
| 2798 | bool _splitFunctionTypes, |
| 2799 | VariableDeclaration::Location _location |
| 2800 | ) |
| 2801 | { |
| 2802 | if (_type.isValueType()) |
| 2803 | return readFromStorageValueType(_type, {}, _splitFunctionTypes, _location); |
| 2804 | |
| 2805 | solAssert(_location != VariableDeclaration::Location::Transient); |
| 2806 | std::string functionName = |
| 2807 | "read_from_storage__dynamic_" + |
| 2808 | std::string(_splitFunctionTypes ? "split_" : "") + |
| 2809 | _type.identifier(); |
| 2810 | |
| 2811 | return m_functionCollector.createFunction(functionName, [&] { |
| 2812 | return Whiskers(R"( |
| 2813 | function <functionName>(slot, offset) -> value { |
| 2814 | if gt(offset, 0) { <panic>() } |
| 2815 | value := <readFromStorage>(slot) |
| 2816 | } |
| 2817 | )") |
| 2818 | ("functionName", functionName) |
| 2819 | ("panic", panicFunction(util::PanicCode::Generic)) |
| 2820 | ("readFromStorage", readFromStorageReferenceType(_type)) |
| 2821 | .render(); |
| 2822 | }); |
| 2823 | } |
| 2824 | |
| 2825 | std::string YulUtilFunctions::readFromStorageValueType( |
| 2826 | Type const& _type, |
no test coverage detected