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

Method generate

libsolidity/interface/StorageLayout.cpp:27–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace solidity::frontend;
26
27Json StorageLayout::generate(ContractDefinition const& _contractDef, DataLocation const _location)
28{
29 solAssert(!m_contract, "");
30 m_contract = &_contractDef;
31 m_types.clear();
32
33 auto typeType = dynamic_cast<TypeType const*>(_contractDef.type());
34 solAssert(typeType, "");
35 auto contractType = dynamic_cast<ContractType const*>(typeType->actualType());
36 solAssert(contractType, "");
37
38 Json variables = Json::array();
39 for (auto [var, slot, offset]: contractType->linearizedStateVariables(_location))
40 variables.emplace_back(generate(*var, slot, offset));
41
42 Json layout;
43 layout["storage"] = std::move(variables);
44 layout["types"] = std::move(m_types);
45
46 return layout;
47}
48
49Json StorageLayout::generate(VariableDeclaration const& _var, u256 const& _slot, unsigned _offset)
50{

Callers

nothing calls this directly

Calls 15

actualTypeMethod · 0.80
fullyQualifiedNameMethod · 0.80
strMethod · 0.80
structDefinitionMethod · 0.80
valueTypeMethod · 0.80
isByteArrayOrStringMethod · 0.80
clearMethod · 0.45
typeMethod · 0.45
nameMethod · 0.45
idMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected