aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-07-24 03:43:38 +0800
committerGitHub <noreply@github.com>2018-07-24 03:43:38 +0800
commitde90290c2882a580ab5e9cc222bd4caa21ac7667 (patch)
tree0748cef73a8bee2c1c51710bd05303425543a50f /libsolidity/analysis
parentb3c8e14952f86ab658ac456f5cce71609498a348 (diff)
parentc622a1e56c0a02b890b45fd15f1fb4cb9d119b3b (diff)
downloaddexon-solidity-de90290c2882a580ab5e9cc222bd4caa21ac7667.tar.gz
dexon-solidity-de90290c2882a580ab5e9cc222bd4caa21ac7667.tar.zst
dexon-solidity-de90290c2882a580ab5e9cc222bd4caa21ac7667.zip
Merge pull request #4527 from ethereum/mappingEnforceStorage
Enforces explicit data location for mappings
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp9
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.");