Make data location explicit.

This commit is contained in:
chriseth 2019-04-16 19:46:12 +02:00
parent 2761aed1d3
commit 4e2d4f02b0
2 changed files with 8 additions and 8 deletions

View File

@ -237,9 +237,9 @@ Type const* TypeProvider::fromElementaryTypeName(ElementaryTypeNameToken const&
case Token::Bool: case Token::Bool:
return boolType(); return boolType();
case Token::Bytes: case Token::Bytes:
return bytesType(); return bytesStorageType();
case Token::String: case Token::String:
return stringType(); return stringStorageType();
default: default:
solAssert( solAssert(
false, false,
@ -293,7 +293,7 @@ TypePointer TypeProvider::fromElementaryTypeName(string const& _name)
} }
} }
ArrayType const* TypeProvider::bytesType() ArrayType const* TypeProvider::bytesStorageType()
{ {
if (!m_bytesStorageType) if (!m_bytesStorageType)
m_bytesStorageType = make_unique<ArrayType>(DataLocation::Storage, false); m_bytesStorageType = make_unique<ArrayType>(DataLocation::Storage, false);
@ -307,7 +307,7 @@ ArrayType const* TypeProvider::bytesMemoryType()
return m_bytesMemoryType.get(); return m_bytesMemoryType.get();
} }
ArrayType const* TypeProvider::stringType() ArrayType const* TypeProvider::stringStorageType()
{ {
if (!m_stringStorageType) if (!m_stringStorageType)
m_stringStorageType = make_unique<ArrayType>(DataLocation::Storage, true); m_stringStorageType = make_unique<ArrayType>(DataLocation::Storage, true);
@ -469,14 +469,14 @@ ArrayType const* TypeProvider::arrayType(DataLocation _location, bool _isString)
if (_isString) if (_isString)
{ {
if (_location == DataLocation::Storage) if (_location == DataLocation::Storage)
return stringType(); return stringStorageType();
if (_location == DataLocation::Memory) if (_location == DataLocation::Memory)
return stringMemoryType(); return stringMemoryType();
} }
else else
{ {
if (_location == DataLocation::Storage) if (_location == DataLocation::Storage)
return bytesType(); return bytesStorageType();
if (_location == DataLocation::Memory) if (_location == DataLocation::Memory)
return bytesMemoryType(); return bytesMemoryType();
} }

View File

@ -66,9 +66,9 @@ public:
static FixedBytesType const* byteType() { return fixedBytesType(1); } static FixedBytesType const* byteType() { return fixedBytesType(1); }
static FixedBytesType const* fixedBytesType(unsigned m) { return m_bytesM.at(m - 1).get(); } static FixedBytesType const* fixedBytesType(unsigned m) { return m_bytesM.at(m - 1).get(); }
static ArrayType const* bytesType(); static ArrayType const* bytesStorageType();
static ArrayType const* bytesMemoryType(); static ArrayType const* bytesMemoryType();
static ArrayType const* stringType(); static ArrayType const* stringStorageType();
static ArrayType const* stringMemoryType(); static ArrayType const* stringMemoryType();
/// Constructor for a byte array ("bytes") and string. /// Constructor for a byte array ("bytes") and string.