mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added externalType for ArrayType
This commit is contained in:
parent
a69d59ae71
commit
607f397234
17
Types.cpp
17
Types.cpp
@ -742,6 +742,23 @@ string ArrayType::toString() const
|
||||
return ret + "]";
|
||||
}
|
||||
|
||||
TypePointer ArrayType::externalType() const
|
||||
{
|
||||
if (m_location != Location::CallData)
|
||||
return TypePointer();
|
||||
if (m_isByteArray)
|
||||
return shared_from_this();
|
||||
if (!(m_baseType->externalType()))
|
||||
return TypePointer();
|
||||
if (dynamic_cast<ArrayType const*>(m_baseType.get()) && m_baseType->isDynamicallySized())
|
||||
return TypePointer();
|
||||
|
||||
if (m_baseType->isDynamicallySized())
|
||||
return std::make_shared<ArrayType>(Location::CallData, m_baseType->externalType());
|
||||
else
|
||||
return std::make_shared<ArrayType>(Location::CallData, m_baseType->externalType(), m_length);
|
||||
}
|
||||
|
||||
shared_ptr<ArrayType> ArrayType::copyForLocation(ArrayType::Location _location) const
|
||||
{
|
||||
auto copy = make_shared<ArrayType>(_location);
|
||||
|
13
Types.h
13
Types.h
@ -188,7 +188,7 @@ public:
|
||||
}
|
||||
|
||||
/// Returns address of type for ABI interface
|
||||
virtual TypePointer ABIType() const { return TypePointer(); }
|
||||
virtual TypePointer externalType() const { return TypePointer(); }
|
||||
|
||||
protected:
|
||||
/// Convenience object used when returning an empty member list.
|
||||
@ -224,7 +224,7 @@ public:
|
||||
|
||||
virtual std::string toString() const override;
|
||||
|
||||
virtual TypePointer ABIType() const override { return shared_from_this(); }
|
||||
virtual TypePointer externalType() const override { return shared_from_this(); }
|
||||
|
||||
int getNumBits() const { return m_bits; }
|
||||
bool isAddress() const { return m_modifier == Modifier::Address; }
|
||||
@ -263,7 +263,7 @@ public:
|
||||
virtual std::string toString() const override;
|
||||
virtual u256 literalValue(Literal const* _literal) const override;
|
||||
virtual TypePointer getRealType() const override;
|
||||
virtual TypePointer ABIType() const override { return shared_from_this(); }
|
||||
virtual TypePointer externalType() const override { return shared_from_this(); }
|
||||
|
||||
/// @returns the smallest integer type that can hold the value or an empty pointer if not possible.
|
||||
std::shared_ptr<IntegerType const> getIntegerType() const;
|
||||
@ -367,7 +367,8 @@ public:
|
||||
virtual unsigned getSizeOnStack() const override;
|
||||
virtual std::string toString() const override;
|
||||
virtual MemberList const& getMembers() const override { return s_arrayTypeMemberList; }
|
||||
virtual TypePointer ABIType() const override { return (m_baseType->ABIType() ? m_baseType->ABIType() : ABIType()); }
|
||||
virtual TypePointer externalType() const override;
|
||||
|
||||
Location getLocation() const { return m_location; }
|
||||
bool isByteArray() const { return m_isByteArray; }
|
||||
TypePointer const& getBaseType() const { solAssert(!!m_baseType, ""); return m_baseType;}
|
||||
@ -406,7 +407,7 @@ public:
|
||||
virtual std::string toString() const override;
|
||||
|
||||
virtual MemberList const& getMembers() const override;
|
||||
virtual TypePointer ABIType() const override { return std::make_shared<IntegerType>(160, IntegerType::Modifier::Address); }
|
||||
virtual TypePointer externalType() const override { return std::make_shared<IntegerType>(160, IntegerType::Modifier::Address); }
|
||||
|
||||
bool isSuper() const { return m_super; }
|
||||
ContractDefinition const& getContractDefinition() const { return m_contract; }
|
||||
@ -475,7 +476,7 @@ public:
|
||||
virtual bool isValueType() const override { return true; }
|
||||
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer ABIType() const override { return std::make_shared<IntegerType>(8 * int(getStorageBytes())); }
|
||||
virtual TypePointer externalType() const override { return std::make_shared<IntegerType>(8 * int(getStorageBytes())); }
|
||||
|
||||
EnumDefinition const& getEnumDefinition() const { return m_enum; }
|
||||
/// @returns the value that the string has in the Enum
|
||||
|
Loading…
Reference in New Issue
Block a user