Refactor data flow analyzer state access.

This commit is contained in:
chriseth
2022-03-14 19:32:33 +01:00
parent e154d43176
commit eab4ca906c
14 changed files with 81 additions and 48 deletions
+5 -5
View File
@@ -82,12 +82,12 @@ void LoadResolver::tryResolve(
YulString key = std::get<Identifier>(_arguments.at(0)).name;
if (_location == StoreLoadLocation::Storage)
{
if (auto value = util::valueOrNullptr(m_storage, key))
if (auto value = storageValue(key))
if (inScope(*value))
_e = Identifier{debugDataOf(_e), *value};
}
else if (!m_containsMSize && _location == StoreLoadLocation::Memory)
if (auto value = util::valueOrNullptr(m_memory, key))
if (auto value = memoryValue(key))
if (inScope(*value))
_e = Identifier{debugDataOf(_e), *value};
}
@@ -129,10 +129,10 @@ void LoadResolver::tryEvaluateKeccak(
if (costOfLiteral > costOfKeccak)
return;
auto memoryValue = util::valueOrNullptr(m_memory, memoryKey->name);
if (memoryValue && inScope(*memoryValue))
optional<YulString> value = memoryValue(memoryKey->name);
if (value && inScope(*value))
{
optional<u256> memoryContent = valueOfIdentifier(*memoryValue);
optional<u256> memoryContent = valueOfIdentifier(*value);
optional<u256> byteLength = valueOfIdentifier(length->name);
if (memoryContent && byteLength && *byteLength <= 32)
{