Merge pull request #4527 from ethereum/mappingEnforceStorage

Enforces explicit data location for mappings
This commit is contained in:
Alex Beregszaszi
2018-07-23 20:43:38 +01:00
committed by GitHub
11 changed files with 46 additions and 11 deletions
+8 -1
View File
@@ -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.");