Enforces data location of local mappings to storage.

This commit is contained in:
Erik Kundt
2018-07-23 19:30:07 +02:00
parent b909df4573
commit c622a1e56c
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.");