Check for scopes in LoadResolver.

This commit is contained in:
Daniel Kirchner 2021-01-06 10:39:19 +01:00
parent eb035147d2
commit 75bed10be5

View File

@ -68,9 +68,11 @@ void LoadResolver::tryResolve(
if (_location == StoreLoadLocation::Storage)
{
if (auto value = util::valueOrNullptr(m_storage, key))
_e = Identifier{locationOf(_e), *value};
if (inScope(*value))
_e = Identifier{locationOf(_e), *value};
}
else if (m_optimizeMLoad && _location == StoreLoadLocation::Memory)
if (auto value = util::valueOrNullptr(m_memory, key))
_e = Identifier{locationOf(_e), *value};
if (inScope(*value))
_e = Identifier{locationOf(_e), *value};
}