mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Properly warn about the use of constants in inline assembly in connection with `_offset
and
_slot
`.
This commit is contained in:
parent
a680cbd474
commit
930485cd24
@ -804,7 +804,12 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
solAssert(!!declaration, "");
|
||||
if (auto var = dynamic_cast<VariableDeclaration const*>(declaration))
|
||||
{
|
||||
if (ref->second.isSlot || ref->second.isOffset)
|
||||
if (var->isConstant())
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "Constant variables not supported by inline assembly.");
|
||||
return size_t(-1);
|
||||
}
|
||||
else if (ref->second.isSlot || ref->second.isOffset)
|
||||
{
|
||||
if (!var->isStateVariable() && !var->type()->dataStoredIn(DataLocation::Storage))
|
||||
{
|
||||
@ -817,11 +822,6 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
return size_t(-1);
|
||||
}
|
||||
}
|
||||
else if (var->isConstant())
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "Constant variables not supported by inline assembly.");
|
||||
return size_t(-1);
|
||||
}
|
||||
else if (!var->isLocalVariable())
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "Only local variables are supported. To access storage variables, use the _slot and _offset suffixes.");
|
||||
|
Loading…
Reference in New Issue
Block a user