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

Method generate

libsolidity/codegen/ir/IRGenerator.cpp:100–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100std::string IRGenerator::generate(
101 ContractDefinition const& _contract,
102 bytes const& _cborMetadata,
103 std::map<ContractDefinition const*, std::string_view const> const& _otherYulSources
104)
105{
106 auto subObjectSources = [&_otherYulSources](UniqueVector<ContractDefinition const*> const& _subObjects) -> std::string
107 {
108 std::string subObjectsSources;
109 for (ContractDefinition const* subObject: _subObjects)
110 subObjectsSources += _otherYulSources.at(subObject);
111 return subObjectsSources;
112 };
113 auto formatUseSrcMap = [](IRGenerationContext const& _context) -> std::string
114 {
115 return joinHumanReadable(
116 ranges::views::transform(_context.usedSourceNames(), [_context](std::string const& _sourceName) {
117 return std::to_string(_context.sourceIndices().at(_sourceName)) + ":" + escapeAndQuoteString(_sourceName);
118 }),
119 ", "
120 );
121 };
122
123 Whiskers t(R"(<?isEthdebugEnabled>/// ethdebug: enabled</isEthdebugEnabled>
124 /// @use-src <useSrcMapCreation>
125 object "<CreationObject>" {
126 code {
127 <sourceLocationCommentCreation>
128 <memoryInitCreation>
129 <callValueCheck>
130 <?library>
131 <!library>
132 <?constructorHasParams> let <constructorParams> := <copyConstructorArguments>() </constructorHasParams>
133 <constructor>(<constructorParams>)
134 </library>
135 <deploy>
136 <functions>
137 }
138 /// @use-src <useSrcMapDeployed>
139 object "<DeployedObject>" {
140 code {
141 <sourceLocationCommentDeployed>
142 <memoryInitDeployed>
143 <?library>
144 <?eof>
145 let called_via_delegatecall := iszero(eq(auxdataloadn(<library_address_immutable_offset>), address()))
146 <!eof>
147 let called_via_delegatecall := iszero(eq(loadimmutable("<library_address>"), address()))
148 </eof>
149 </library>
150 <dispatch>
151 <deployedFunctions>
152 }
153 <deployedSubObjects>
154 data "<metadataName>" hex"<cborMetadata>"
155 }
156 <subObjects>
157 }

Callers 1

generateModifierMethod · 0.45

Calls 15

joinHumanReadableFunction · 0.85
ContractTypeClass · 0.85
dispenseLocationCommentFunction · 0.85
constructorFunction · 0.85
toHexFunction · 0.85
verifyCallGraphFunction · 0.85
atMethod · 0.80
isLibraryMethod · 0.80
immutableVariablesMethod · 0.80

Tested by

no test coverage detected