Remove special treatment of `var`.

This commit is contained in:
chriseth
2020-07-20 17:22:04 +02:00
parent f945163909
commit 93c792c696
39 changed files with 272 additions and 535 deletions
+4 -19
View File
@@ -614,9 +614,8 @@ bool VariableDeclaration::isEventParameter() const
bool VariableDeclaration::hasReferenceOrMappingType() const
{
solAssert(typeName(), "");
solAssert(typeName()->annotation().type, "Can only be called after reference resolution");
Type const* type = typeName()->annotation().type;
solAssert(typeName().annotation().type, "Can only be called after reference resolution");
Type const* type = typeName().annotation().type;
return type->category() == Type::Category::Mapping || dynamic_cast<ReferenceType const*>(type);
}
@@ -642,22 +641,8 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
return locations;
}
else if (isLocalVariable())
{
solAssert(typeName(), "");
auto dataLocations = [](TypePointer _type, auto&& _recursion) -> set<Location> {
solAssert(_type, "Can only be called after reference resolution");
switch (_type->category())
{
case Type::Category::Array:
return _recursion(dynamic_cast<ArrayType const*>(_type)->baseType(), _recursion);
case Type::Category::Mapping:
return set<Location>{ Location::Storage };
default:
return set<Location>{ Location::Memory, Location::Storage, Location::CallData };
}
};
return dataLocations(typeName()->annotation().type, dataLocations);
}
// Further restrictions will be imposed later on.
return set<Location>{ Location::Memory, Location::Storage, Location::CallData };
else
// Struct members etc.
return set<Location>{ Location::Unspecified };