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

Method arrayDataAreaFunction

libsolidity/codegen/YulUtilFunctions.cpp:2391–2420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2389}
2390
2391std::string YulUtilFunctions::arrayDataAreaFunction(ArrayType const& _type)
2392{
2393 std::string functionName = "array_dataslot_" + _type.identifier();
2394 return m_functionCollector.createFunction(functionName, [&]() {
2395 // No special processing for calldata arrays, because they are stored as
2396 // offset of the data area and length on the stack, so the offset already
2397 // points to the data area.
2398 // This might change, if calldata arrays are stored in a single
2399 // stack slot at some point.
2400 return Whiskers(R"(
2401 function <functionName>(ptr) -> data {
2402 data := ptr
2403 <?dynamic>
2404 <?memory>
2405 data := add(ptr, 0x20)
2406 </memory>
2407 <?storage>
2408 mstore(0, ptr)
2409 data := keccak256(0, 0x20)
2410 </storage>
2411 </dynamic>
2412 }
2413 )")
2414 ("functionName", functionName)
2415 ("dynamic", _type.isDynamicallySized())
2416 ("memory", _type.location() == DataLocation::Memory)
2417 ("storage", _type.location() == DataLocation::Storage)
2418 .render();
2419 });
2420}
2421
2422std::string YulUtilFunctions::storageArrayIndexAccessFunction(ArrayType const& _type)
2423{

Callers 3

endVisitMethod · 0.80

Calls 6

WhiskersClass · 0.85
identifierMethod · 0.80
renderMethod · 0.80
createFunctionMethod · 0.45
isDynamicallySizedMethod · 0.45
locationMethod · 0.45

Tested by

no test coverage detected