MCPcopy Create free account
hub / github.com/argotorg/solidity / readFromStorageDynamic

Method readFromStorageDynamic

libsolidity/codegen/YulUtilFunctions.cpp:2796–2823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2794}
2795
2796std::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
2825std::string YulUtilFunctions::readFromStorageValueType(
2826 Type const& _type,

Callers 2

readFromLValueMethod · 0.80
generateGetterMethod · 0.80

Calls 5

WhiskersClass · 0.85
identifierMethod · 0.80
renderMethod · 0.80
isValueTypeMethod · 0.45
createFunctionMethod · 0.45

Tested by

no test coverage detected