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

Method allocateMemoryArrayFunction

libsolidity/codegen/YulUtilFunctions.cpp:3320–3339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3318}
3319
3320std::string YulUtilFunctions::allocateMemoryArrayFunction(ArrayType const& _type)
3321{
3322 std::string functionName = "allocate_memory_array_" + _type.identifier();
3323 return m_functionCollector.createFunction(functionName, [&]() {
3324 return Whiskers(R"(
3325 function <functionName>(length) -> memPtr {
3326 let allocSize := <allocSize>(length)
3327 memPtr := <alloc>(allocSize)
3328 <?dynamic>
3329 mstore(memPtr, length)
3330 </dynamic>
3331 }
3332 )")
3333 ("functionName", functionName)
3334 ("alloc", allocationFunction())
3335 ("allocSize", arrayAllocationSizeFunction(_type))
3336 ("dynamic", _type.isDynamicallySized())
3337 .render();
3338 });
3339}
3340
3341std::string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType const& _type)
3342{

Callers 1

visitMethod · 0.80

Calls 5

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

Tested by

no test coverage detected