mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[yul] Adding support for accessing subobjects via .
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
co-authored by
Kamil Śliwak
parent
952101996c
commit
6f97e6153c
@@ -147,22 +147,28 @@ pair<shared_ptr<AbstractAssembly>, AbstractAssembly::SubID> EthAssemblyAdapter::
|
||||
return {make_shared<EthAssemblyAdapter>(*assembly), static_cast<size_t>(sub.data())};
|
||||
}
|
||||
|
||||
void EthAssemblyAdapter::appendDataOffset(AbstractAssembly::SubID _sub)
|
||||
void EthAssemblyAdapter::appendDataOffset(vector<AbstractAssembly::SubID> const& _subPath)
|
||||
{
|
||||
auto it = m_dataHashBySubId.find(_sub);
|
||||
if (it == m_dataHashBySubId.end())
|
||||
m_assembly.pushSubroutineOffset(_sub);
|
||||
else
|
||||
if (auto it = m_dataHashBySubId.find(_subPath[0]); it != m_dataHashBySubId.end())
|
||||
{
|
||||
yulAssert(_subPath.size() == 1, "");
|
||||
m_assembly << evmasm::AssemblyItem(evmasm::PushData, it->second);
|
||||
return;
|
||||
}
|
||||
|
||||
m_assembly.pushSubroutineOffset(m_assembly.encodeSubPath(_subPath));
|
||||
}
|
||||
|
||||
void EthAssemblyAdapter::appendDataSize(AbstractAssembly::SubID _sub)
|
||||
void EthAssemblyAdapter::appendDataSize(vector<AbstractAssembly::SubID> const& _subPath)
|
||||
{
|
||||
auto it = m_dataHashBySubId.find(_sub);
|
||||
if (it == m_dataHashBySubId.end())
|
||||
m_assembly.pushSubroutineSize(static_cast<size_t>(_sub));
|
||||
else
|
||||
if (auto it = m_dataHashBySubId.find(_subPath[0]); it != m_dataHashBySubId.end())
|
||||
{
|
||||
yulAssert(_subPath.size() == 1, "");
|
||||
m_assembly << u256(m_assembly.data(h256(it->second)).size());
|
||||
return;
|
||||
}
|
||||
|
||||
m_assembly.pushSubroutineSize(m_assembly.encodeSubPath(_subPath));
|
||||
}
|
||||
|
||||
AbstractAssembly::SubID EthAssemblyAdapter::appendData(bytes const& _data)
|
||||
|
||||
Reference in New Issue
Block a user