mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Initial introduction of array slices with partial implementation for dynamic calldata arrays.
This commit is contained in:
@@ -31,6 +31,7 @@ InaccessibleDynamicType const TypeProvider::m_inaccessibleDynamic{};
|
||||
/// they rely on `byte` being available which we cannot guarantee in the static init context.
|
||||
unique_ptr<ArrayType> TypeProvider::m_bytesStorage;
|
||||
unique_ptr<ArrayType> TypeProvider::m_bytesMemory;
|
||||
unique_ptr<ArrayType> TypeProvider::m_bytesCalldata;
|
||||
unique_ptr<ArrayType> TypeProvider::m_stringStorage;
|
||||
unique_ptr<ArrayType> TypeProvider::m_stringMemory;
|
||||
|
||||
@@ -177,6 +178,7 @@ void TypeProvider::reset()
|
||||
clearCache(m_inaccessibleDynamic);
|
||||
clearCache(m_bytesStorage);
|
||||
clearCache(m_bytesMemory);
|
||||
clearCache(m_bytesCalldata);
|
||||
clearCache(m_stringStorage);
|
||||
clearCache(m_stringMemory);
|
||||
clearCache(m_emptyTuple);
|
||||
@@ -314,6 +316,13 @@ ArrayType const* TypeProvider::bytesMemory()
|
||||
return m_bytesMemory.get();
|
||||
}
|
||||
|
||||
ArrayType const* TypeProvider::bytesCalldata()
|
||||
{
|
||||
if (!m_bytesCalldata)
|
||||
m_bytesCalldata = make_unique<ArrayType>(DataLocation::CallData, false);
|
||||
return m_bytesCalldata.get();
|
||||
}
|
||||
|
||||
ArrayType const* TypeProvider::stringStorage()
|
||||
{
|
||||
if (!m_stringStorage)
|
||||
@@ -500,6 +509,11 @@ ArrayType const* TypeProvider::array(DataLocation _location, Type const* _baseTy
|
||||
return createAndGet<ArrayType>(_location, _baseType, _length);
|
||||
}
|
||||
|
||||
ArraySliceType const* TypeProvider::arraySlice(ArrayType const& _arrayType)
|
||||
{
|
||||
return createAndGet<ArraySliceType>(_arrayType);
|
||||
}
|
||||
|
||||
ContractType const* TypeProvider::contract(ContractDefinition const& _contractDef, bool _isSuper)
|
||||
{
|
||||
return createAndGet<ContractType>(_contractDef, _isSuper);
|
||||
|
||||
Reference in New Issue
Block a user