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

Method immutableVariableSlotNames

libsolidity/codegen/CompilerContext.cpp:90–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90std::vector<std::string> CompilerContext::immutableVariableSlotNames(VariableDeclaration const& _variable)
91{
92 std::string baseName = std::to_string(_variable.id());
93 solAssert(_variable.annotation().type->sizeOnStack() > 0, "");
94 if (_variable.annotation().type->sizeOnStack() == 1)
95 return {baseName};
96 std::vector<std::string> names;
97 auto collectSlotNames = [&](std::string const& _baseName, Type const* type, auto const& _recurse) -> void {
98 for (auto const& [slot, type]: type->stackItems())
99 if (type)
100 _recurse(_baseName + " " + slot, type, _recurse);
101 else
102 names.emplace_back(_baseName);
103 };
104 collectSlotNames(baseName, _variable.annotation().type, collectSlotNames);
105 return names;
106}
107
108size_t CompilerContext::reservedMemory()
109{

Callers 2

retrieveValueMethod · 0.80

Calls 3

to_stringFunction · 0.50
idMethod · 0.45
sizeOnStackMethod · 0.45

Tested by

no test coverage detected