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

Method declareAssign

libsolidity/codegen/ir/IRGeneratorForStatements.cpp:3001–3022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2999}
3000
3001void IRGeneratorForStatements::declareAssign(IRVariable const& _lhs, IRVariable const& _rhs, bool _declare, bool _forceCleanup)
3002{
3003 std::string output;
3004 if (_lhs.type() == _rhs.type() && !_forceCleanup)
3005 for (auto const& [stackItemName, stackItemType]: _lhs.type().stackItems())
3006 if (stackItemType)
3007 declareAssign(_lhs.part(stackItemName), _rhs.part(stackItemName), _declare);
3008 else
3009 appendCode() << (_declare ? "let ": "") << _lhs.part(stackItemName).name() << " := " << _rhs.part(stackItemName).name() << "\n";
3010 else
3011 {
3012 if (_lhs.type().sizeOnStack() > 0)
3013 appendCode() <<
3014 (_declare ? "let ": "") <<
3015 _lhs.commaSeparatedList() <<
3016 " := ";
3017 appendCode() << m_context.utils().conversionFunction(_rhs.type(), _lhs.type()) <<
3018 "(" <<
3019 _rhs.commaSeparatedList() <<
3020 ")\n";
3021 }
3022}
3023
3024IRVariable IRGeneratorForStatements::zeroValue(Type const& _type, bool _splitFunctionTypes)
3025{

Callers

nothing calls this directly

Calls 7

partMethod · 0.80
commaSeparatedListMethod · 0.80
conversionFunctionMethod · 0.80
typeMethod · 0.45
nameMethod · 0.45
sizeOnStackMethod · 0.45
utilsMethod · 0.45

Tested by

no test coverage detected