mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4527 from ethereum/mappingEnforceStorage
Enforces explicit data location for mappings
This commit is contained in:
@@ -404,9 +404,16 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
||||
}
|
||||
isPointer = !_variable.isStateVariable();
|
||||
}
|
||||
|
||||
type = ref->copyForLocation(typeLoc, isPointer);
|
||||
}
|
||||
else if (dynamic_cast<MappingType const*>(type.get()))
|
||||
{
|
||||
if (_variable.isLocalVariable() && varLoc != Location::Storage)
|
||||
typeError(
|
||||
_variable.location(),
|
||||
"Data location for mappings must be specified as \"storage\"."
|
||||
);
|
||||
}
|
||||
else if (varLoc != Location::Default && !ref)
|
||||
typeError(_variable.location(), "Data location can only be given for array or struct types.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user