diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-07-18 23:20:26 +0800 |
---|---|---|
committer | Erik Kundt <bitshift@posteo.org> | 2018-07-24 01:30:07 +0800 |
commit | c622a1e56c0a02b890b45fd15f1fb4cb9d119b3b (patch) | |
tree | 48d2d0b7f17ceafd1a7dd4646860324a19fad563 /libsolidity/analysis/ReferencesResolver.cpp | |
parent | b909df4573130e020c7f4dfb61c0571ba1bc02ab (diff) | |
download | dexon-solidity-c622a1e56c0a02b890b45fd15f1fb4cb9d119b3b.tar.gz dexon-solidity-c622a1e56c0a02b890b45fd15f1fb4cb9d119b3b.tar.zst dexon-solidity-c622a1e56c0a02b890b45fd15f1fb4cb9d119b3b.zip |
Enforces data location of local mappings to storage.
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r-- | libsolidity/analysis/ReferencesResolver.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index dfcbf888..5815e3d2 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -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."); |