mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4724 from ethereum/slot-in-assembly
Do not crash on using _slot and _offset suffixes on their own
This commit is contained in:
commit
8b2d630275
@ -81,6 +81,7 @@ Bugfixes:
|
|||||||
* Code Generator: Fix allocation of byte arrays (zeroed out too much memory).
|
* Code Generator: Fix allocation of byte arrays (zeroed out too much memory).
|
||||||
* Commandline Interface: Correctly handle paths with backslashes on windows.
|
* Commandline Interface: Correctly handle paths with backslashes on windows.
|
||||||
* Fix NatSpec json output for `@notice` and `@dev` tags on contract definitions.
|
* Fix NatSpec json output for `@notice` and `@dev` tags on contract definitions.
|
||||||
|
* References Resolver: Do not crash on using ``_slot`` and ``_offset`` suffixes on their own.
|
||||||
* References Resolver: Enforce ``storage`` as data location for mappings.
|
* References Resolver: Enforce ``storage`` as data location for mappings.
|
||||||
* References Resolver: Report error instead of assertion fail when FunctionType has an undeclared type as parameter.
|
* References Resolver: Report error instead of assertion fail when FunctionType has an undeclared type as parameter.
|
||||||
* Type Checker: Disallow assignments to mappings within tuple assignments as well.
|
* Type Checker: Disallow assignments to mappings within tuple assignments as well.
|
||||||
|
@ -256,6 +256,11 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
string("_slot").size() :
|
string("_slot").size() :
|
||||||
string("_offset").size()
|
string("_offset").size()
|
||||||
));
|
));
|
||||||
|
if (realName.empty())
|
||||||
|
{
|
||||||
|
declarationError(_identifier.location, "In variable names _slot and _offset can only be used as a suffix.");
|
||||||
|
return size_t(-1);
|
||||||
|
}
|
||||||
declarations = m_resolver.nameFromCurrentScope(realName);
|
declarations = m_resolver.nameFromCurrentScope(realName);
|
||||||
}
|
}
|
||||||
if (declarations.size() != 1)
|
if (declarations.size() != 1)
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
contract C {
|
||||||
|
function f() public pure {
|
||||||
|
assembly {
|
||||||
|
_offset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// DeclarationError: (75-82): In variable names _slot and _offset can only be used as a suffix.
|
@ -0,0 +1,9 @@
|
|||||||
|
contract C {
|
||||||
|
function f() public pure {
|
||||||
|
assembly {
|
||||||
|
_slot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// DeclarationError: (75-80): In variable names _slot and _offset can only be used as a suffix.
|
Loading…
Reference in New Issue
Block a user