mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Removing redundant virtual from override function declaration
Remove trailing whitespace Remove changelog change
This commit is contained in:
+256
-256
@@ -331,31 +331,31 @@ public:
|
||||
static AddressType& address() { static std::shared_ptr<AddressType> addr(std::make_shared<AddressType>(StateMutability::NonPayable)); return *addr; }
|
||||
static AddressType& addressPayable() { static std::shared_ptr<AddressType> addr(std::make_shared<AddressType>(StateMutability::Payable)); return *addr; }
|
||||
|
||||
virtual Category category() const override { return Category::Address; }
|
||||
Category category() const override { return Category::Address; }
|
||||
|
||||
explicit AddressType(StateMutability _stateMutability);
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _other) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _other) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
|
||||
virtual unsigned calldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : 160 / 8; }
|
||||
virtual unsigned storageBytes() const override { return 160 / 8; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
unsigned calldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : 160 / 8; }
|
||||
unsigned storageBytes() const override { return 160 / 8; }
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
std::string toString(bool _short) const override;
|
||||
std::string canonicalName() const override;
|
||||
|
||||
virtual u256 literalValue(Literal const* _literal) const override;
|
||||
u256 literalValue(Literal const* _literal) const override;
|
||||
|
||||
virtual TypePointer encodingType() const override { return shared_from_this(); }
|
||||
virtual TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
TypePointer encodingType() const override { return shared_from_this(); }
|
||||
TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
|
||||
StateMutability stateMutability(void) const { return m_stateMutability; }
|
||||
|
||||
@@ -374,26 +374,26 @@ public:
|
||||
Unsigned, Signed
|
||||
};
|
||||
|
||||
virtual Category category() const override { return Category::Integer; }
|
||||
Category category() const override { return Category::Integer; }
|
||||
|
||||
explicit IntegerType(unsigned _bits, Modifier _modifier = Modifier::Unsigned);
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
|
||||
virtual unsigned calldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : m_bits / 8; }
|
||||
virtual unsigned storageBytes() const override { return m_bits / 8; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
unsigned calldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : m_bits / 8; }
|
||||
unsigned storageBytes() const override { return m_bits / 8; }
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
virtual std::string toString(bool _short) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
virtual TypePointer encodingType() const override { return shared_from_this(); }
|
||||
virtual TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
TypePointer encodingType() const override { return shared_from_this(); }
|
||||
TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
|
||||
unsigned numBits() const { return m_bits; }
|
||||
bool isSigned() const { return m_modifier == Modifier::Signed; }
|
||||
@@ -416,26 +416,26 @@ public:
|
||||
{
|
||||
Unsigned, Signed
|
||||
};
|
||||
virtual Category category() const override { return Category::FixedPoint; }
|
||||
Category category() const override { return Category::FixedPoint; }
|
||||
|
||||
explicit FixedPointType(unsigned _totalBits, unsigned _fractionalDigits, Modifier _modifier = Modifier::Unsigned);
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
|
||||
virtual unsigned calldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : m_totalBits / 8; }
|
||||
virtual unsigned storageBytes() const override { return m_totalBits / 8; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
unsigned calldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : m_totalBits / 8; }
|
||||
unsigned storageBytes() const override { return m_totalBits / 8; }
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
virtual std::string toString(bool _short) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
virtual TypePointer encodingType() const override { return shared_from_this(); }
|
||||
virtual TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
TypePointer encodingType() const override { return shared_from_this(); }
|
||||
TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
|
||||
/// Number of bits used for this type in total.
|
||||
unsigned numBits() const { return m_totalBits; }
|
||||
@@ -467,7 +467,7 @@ class RationalNumberType: public Type
|
||||
{
|
||||
public:
|
||||
|
||||
virtual Category category() const override { return Category::RationalNumber; }
|
||||
Category category() const override { return Category::RationalNumber; }
|
||||
|
||||
static TypePointer forLiteral(Literal const& _literal);
|
||||
|
||||
@@ -475,20 +475,20 @@ public:
|
||||
m_value(_value), m_compatibleBytesType(_compatibleBytesType)
|
||||
{}
|
||||
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
bool canBeStored() const override { return false; }
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual u256 literalValue(Literal const* _literal) const override;
|
||||
virtual TypePointer mobileType() const override;
|
||||
std::string toString(bool _short) const override;
|
||||
u256 literalValue(Literal const* _literal) const override;
|
||||
TypePointer mobileType() const override;
|
||||
|
||||
/// @returns the smallest integer type that can hold the value or an empty pointer if not possible.
|
||||
std::shared_ptr<IntegerType const> integerType() const;
|
||||
@@ -530,25 +530,25 @@ private:
|
||||
class StringLiteralType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::StringLiteral; }
|
||||
Category category() const override { return Category::StringLiteral; }
|
||||
|
||||
explicit StringLiteralType(Literal const& _literal);
|
||||
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override
|
||||
{
|
||||
return TypePointer();
|
||||
}
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual unsigned sizeOnStack() const override { return 0; }
|
||||
bool canBeStored() const override { return false; }
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
unsigned sizeOnStack() const override { return 0; }
|
||||
|
||||
virtual std::string toString(bool) const override;
|
||||
virtual TypePointer mobileType() const override;
|
||||
std::string toString(bool) const override;
|
||||
TypePointer mobileType() const override;
|
||||
|
||||
bool isValidUTF8() const;
|
||||
|
||||
@@ -564,25 +564,25 @@ private:
|
||||
class FixedBytesType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::FixedBytes; }
|
||||
Category category() const override { return Category::FixedBytes; }
|
||||
|
||||
explicit FixedBytesType(unsigned _bytes);
|
||||
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override { return _padded && m_bytes > 0 ? 32 : m_bytes; }
|
||||
virtual unsigned storageBytes() const override { return m_bytes; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
unsigned calldataEncodedSize(bool _padded) const override { return _padded && m_bytes > 0 ? 32 : m_bytes; }
|
||||
unsigned storageBytes() const override { return m_bytes; }
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
virtual std::string toString(bool) const override { return "bytes" + dev::toString(m_bytes); }
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
virtual TypePointer encodingType() const override { return shared_from_this(); }
|
||||
virtual TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
std::string toString(bool) const override { return "bytes" + dev::toString(m_bytes); }
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
TypePointer encodingType() const override { return shared_from_this(); }
|
||||
TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
|
||||
unsigned numBytes() const { return m_bytes; }
|
||||
|
||||
@@ -597,19 +597,19 @@ class BoolType: public Type
|
||||
{
|
||||
public:
|
||||
BoolType() {}
|
||||
virtual Category category() const override { return Category::Bool; }
|
||||
virtual std::string richIdentifier() const override { return "t_bool"; }
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
Category category() const override { return Category::Bool; }
|
||||
std::string richIdentifier() const override { return "t_bool"; }
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override;
|
||||
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override{ return _padded ? 32 : 1; }
|
||||
virtual unsigned storageBytes() const override { return 1; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
unsigned calldataEncodedSize(bool _padded) const override{ return _padded ? 32 : 1; }
|
||||
unsigned storageBytes() const override { return 1; }
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
virtual std::string toString(bool) const override { return "bool"; }
|
||||
virtual u256 literalValue(Literal const* _literal) const override;
|
||||
virtual TypePointer encodingType() const override { return shared_from_this(); }
|
||||
virtual TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
std::string toString(bool) const override { return "bool"; }
|
||||
u256 literalValue(Literal const* _literal) const override;
|
||||
TypePointer encodingType() const override { return shared_from_this(); }
|
||||
TypePointer interfaceType(bool) const override { return shared_from_this(); }
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -622,20 +622,20 @@ public:
|
||||
explicit ReferenceType(DataLocation _location): m_location(_location) {}
|
||||
DataLocation location() const { return m_location; }
|
||||
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override
|
||||
{
|
||||
return TypePointer();
|
||||
}
|
||||
virtual unsigned memoryHeadSize() const override { return 32; }
|
||||
unsigned memoryHeadSize() const override { return 32; }
|
||||
|
||||
/// @returns a copy of this type with location (recursively) changed to @a _location,
|
||||
/// whereas isPointer is only shallowly changed - the deep copy is always a bound reference.
|
||||
virtual TypePointer copyForLocation(DataLocation _location, bool _isPointer) const = 0;
|
||||
|
||||
virtual TypePointer mobileType() const override { return copyForLocation(m_location, true); }
|
||||
virtual bool dataStoredIn(DataLocation _location) const override { return m_location == _location; }
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
TypePointer mobileType() const override { return copyForLocation(m_location, true); }
|
||||
bool dataStoredIn(DataLocation _location) const override { return m_location == _location; }
|
||||
bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
|
||||
/// Storage references can be pointers or bound references. In general, local variables are of
|
||||
/// pointer type, state variables are bound references. Assignments to pointers or deleting
|
||||
@@ -677,7 +677,7 @@ public:
|
||||
static ArrayType& bytesMemory() { static std::shared_ptr<ArrayType> addr(std::make_shared<ArrayType>(DataLocation::Memory)); return *addr; }
|
||||
static ArrayType& stringMemory() { static std::shared_ptr<ArrayType> addr(std::make_shared<ArrayType>(DataLocation::Memory, true)); return *addr; }
|
||||
|
||||
virtual Category category() const override { return Category::Array; }
|
||||
Category category() const override { return Category::Array; }
|
||||
|
||||
/// Constructor for a byte array ("bytes") and string.
|
||||
explicit ArrayType(DataLocation _location, bool _isString = false):
|
||||
@@ -700,24 +700,24 @@ public:
|
||||
m_length(_length)
|
||||
{}
|
||||
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(const Type& _other) const override;
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override;
|
||||
virtual bool isDynamicallySized() const override { return m_hasDynamicLength; }
|
||||
virtual bool isDynamicallyEncoded() const override;
|
||||
virtual u256 storageSize() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); }
|
||||
virtual unsigned sizeOnStack() const override;
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual std::string signatureInExternalFunction(bool _structsByName) const override;
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
virtual TypePointer encodingType() const override;
|
||||
virtual TypePointer decodingType() const override;
|
||||
virtual TypePointer interfaceType(bool _inLibrary) const override;
|
||||
virtual bool canBeUsedExternally(bool _inLibrary) const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(const Type& _other) const override;
|
||||
unsigned calldataEncodedSize(bool _padded) const override;
|
||||
bool isDynamicallySized() const override { return m_hasDynamicLength; }
|
||||
bool isDynamicallyEncoded() const override;
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); }
|
||||
unsigned sizeOnStack() const override;
|
||||
std::string toString(bool _short) const override;
|
||||
std::string canonicalName() const override;
|
||||
std::string signatureInExternalFunction(bool _structsByName) const override;
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
TypePointer encodingType() const override;
|
||||
TypePointer decodingType() const override;
|
||||
TypePointer interfaceType(bool _inLibrary) const override;
|
||||
bool canBeUsedExternally(bool _inLibrary) const override;
|
||||
|
||||
/// @returns true if this is valid to be stored in calldata
|
||||
bool validForCalldata() const;
|
||||
@@ -751,36 +751,36 @@ private:
|
||||
class ContractType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Contract; }
|
||||
Category category() const override { return Category::Contract; }
|
||||
explicit ContractType(ContractDefinition const& _contract, bool _super = false):
|
||||
m_contract(_contract), m_super(_super) {}
|
||||
/// Contracts can be implicitly converted only to base contracts.
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
/// Contracts can only be explicitly converted to address types and base contracts.
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual unsigned calldataEncodedSize(bool _padded ) const override
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
unsigned calldataEncodedSize(bool _padded ) const override
|
||||
{
|
||||
solAssert(!isSuper(), "");
|
||||
return encodingType()->calldataEncodedSize(_padded);
|
||||
}
|
||||
virtual unsigned storageBytes() const override { solAssert(!isSuper(), ""); return 20; }
|
||||
virtual bool canLiveOutsideStorage() const override { return !isSuper(); }
|
||||
virtual unsigned sizeOnStack() const override { return m_super ? 0 : 1; }
|
||||
virtual bool isValueType() const override { return !isSuper(); }
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
unsigned storageBytes() const override { solAssert(!isSuper(), ""); return 20; }
|
||||
bool canLiveOutsideStorage() const override { return !isSuper(); }
|
||||
unsigned sizeOnStack() const override { return m_super ? 0 : 1; }
|
||||
bool isValueType() const override { return !isSuper(); }
|
||||
std::string toString(bool _short) const override;
|
||||
std::string canonicalName() const override;
|
||||
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
virtual TypePointer encodingType() const override
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
TypePointer encodingType() const override
|
||||
{
|
||||
if (isSuper())
|
||||
return TypePointer{};
|
||||
return std::make_shared<AddressType>(isPayable() ? StateMutability::Payable : StateMutability::NonPayable);
|
||||
}
|
||||
virtual TypePointer interfaceType(bool _inLibrary) const override
|
||||
TypePointer interfaceType(bool _inLibrary) const override
|
||||
{
|
||||
if (isSuper())
|
||||
return TypePointer{};
|
||||
@@ -816,31 +816,31 @@ private:
|
||||
class StructType: public ReferenceType
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Struct; }
|
||||
Category category() const override { return Category::Struct; }
|
||||
explicit StructType(StructDefinition const& _struct, DataLocation _location = DataLocation::Storage):
|
||||
ReferenceType(_location), m_struct(_struct) {}
|
||||
virtual bool isImplicitlyConvertibleTo(const Type& _convertTo) const override;
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override;
|
||||
virtual bool isDynamicallyEncoded() const override;
|
||||
bool isImplicitlyConvertibleTo(const Type& _convertTo) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
unsigned calldataEncodedSize(bool _padded) const override;
|
||||
bool isDynamicallyEncoded() const override;
|
||||
u256 memorySize() const;
|
||||
virtual u256 storageSize() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return true; }
|
||||
virtual std::string toString(bool _short) const override;
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return true; }
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
virtual TypePointer encodingType() const override
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
TypePointer encodingType() const override
|
||||
{
|
||||
return location() == DataLocation::Storage ? std::make_shared<IntegerType>(256) : shared_from_this();
|
||||
}
|
||||
virtual TypePointer interfaceType(bool _inLibrary) const override;
|
||||
virtual bool canBeUsedExternally(bool _inLibrary) const override;
|
||||
TypePointer interfaceType(bool _inLibrary) const override;
|
||||
bool canBeUsedExternally(bool _inLibrary) const override;
|
||||
|
||||
TypePointer copyForLocation(DataLocation _location, bool _isPointer) const override;
|
||||
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual std::string signatureInExternalFunction(bool _structsByName) const override;
|
||||
std::string canonicalName() const override;
|
||||
std::string signatureInExternalFunction(bool _structsByName) const override;
|
||||
|
||||
/// @returns a function that performs the type conversion between a list of struct members
|
||||
/// and a memory struct of this type.
|
||||
@@ -872,27 +872,27 @@ private:
|
||||
class EnumType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Enum; }
|
||||
Category category() const override { return Category::Enum; }
|
||||
explicit EnumType(EnumDefinition const& _enum): m_enum(_enum) {}
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
unsigned calldataEncodedSize(bool _padded) const override
|
||||
{
|
||||
return encodingType()->calldataEncodedSize(_padded);
|
||||
}
|
||||
virtual unsigned storageBytes() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return true; }
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual bool isValueType() const override { return true; }
|
||||
unsigned storageBytes() const override;
|
||||
bool canLiveOutsideStorage() const override { return true; }
|
||||
std::string toString(bool _short) const override;
|
||||
std::string canonicalName() const override;
|
||||
bool isValueType() const override { return true; }
|
||||
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer encodingType() const override
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer encodingType() const override
|
||||
{
|
||||
return std::make_shared<IntegerType>(8 * int(storageBytes()));
|
||||
}
|
||||
virtual TypePointer interfaceType(bool _inLibrary) const override
|
||||
TypePointer interfaceType(bool _inLibrary) const override
|
||||
{
|
||||
return _inLibrary ? shared_from_this() : encodingType();
|
||||
}
|
||||
@@ -913,21 +913,21 @@ private:
|
||||
class TupleType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Tuple; }
|
||||
Category category() const override { return Category::Tuple; }
|
||||
explicit TupleType(std::vector<TypePointer> const& _types = std::vector<TypePointer>()): m_components(_types) {}
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _other) const override;
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual std::string toString(bool) const override;
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual u256 storageSize() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual unsigned sizeOnStack() const override;
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
virtual TypePointer mobileType() const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _other) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
std::string toString(bool) const override;
|
||||
bool canBeStored() const override { return false; }
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
unsigned sizeOnStack() const override;
|
||||
bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
TypePointer mobileType() const override;
|
||||
/// Converts components to their temporary types and performs some wildcard matching.
|
||||
virtual TypePointer closestTemporaryType(TypePointer const& _targetType) const override;
|
||||
TypePointer closestTemporaryType(TypePointer const& _targetType) const override;
|
||||
|
||||
std::vector<TypePointer> const& components() const { return m_components; }
|
||||
|
||||
@@ -987,7 +987,7 @@ public:
|
||||
GasLeft, ///< gasleft()
|
||||
};
|
||||
|
||||
virtual Category category() const override { return Category::Function; }
|
||||
Category category() const override { return Category::Function; }
|
||||
|
||||
/// Creates the type of a function.
|
||||
explicit FunctionType(FunctionDefinition const& _function, bool _isInternal = true);
|
||||
@@ -1061,25 +1061,25 @@ public:
|
||||
/// @returns the "self" parameter type for a bound function
|
||||
TypePointer const& selfType() const;
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override;
|
||||
virtual bool canBeStored() const override { return m_kind == Kind::Internal || m_kind == Kind::External; }
|
||||
virtual u256 storageSize() const override;
|
||||
virtual unsigned storageBytes() const override;
|
||||
virtual bool isValueType() const override { return true; }
|
||||
virtual bool canLiveOutsideStorage() const override { return m_kind == Kind::Internal || m_kind == Kind::External; }
|
||||
virtual unsigned sizeOnStack() const override;
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
virtual TypePointer encodingType() const override;
|
||||
virtual TypePointer interfaceType(bool _inLibrary) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
bool isImplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
TypePointer unaryOperatorResult(Token _operator) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override;
|
||||
std::string canonicalName() const override;
|
||||
std::string toString(bool _short) const override;
|
||||
unsigned calldataEncodedSize(bool _padded) const override;
|
||||
bool canBeStored() const override { return m_kind == Kind::Internal || m_kind == Kind::External; }
|
||||
u256 storageSize() const override;
|
||||
unsigned storageBytes() const override;
|
||||
bool isValueType() const override { return true; }
|
||||
bool canLiveOutsideStorage() const override { return m_kind == Kind::Internal || m_kind == Kind::External; }
|
||||
unsigned sizeOnStack() const override;
|
||||
bool hasSimpleZeroValueInMemory() const override { return false; }
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
TypePointer encodingType() const override;
|
||||
TypePointer interfaceType(bool _inLibrary) const override;
|
||||
|
||||
/// @returns TypePointer of a new FunctionType object. All input/return parameters are an
|
||||
/// appropriate external types (i.e. the interfaceType()s) of input/return parameters of
|
||||
@@ -1187,27 +1187,27 @@ private:
|
||||
class MappingType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Mapping; }
|
||||
Category category() const override { return Category::Mapping; }
|
||||
MappingType(TypePointer const& _keyType, TypePointer const& _valueType):
|
||||
m_keyType(_keyType), m_valueType(_valueType) {}
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual TypePointer encodingType() const override
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
std::string canonicalName() const override;
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
TypePointer encodingType() const override
|
||||
{
|
||||
return std::make_shared<IntegerType>(256);
|
||||
}
|
||||
virtual TypePointer interfaceType(bool _inLibrary) const override
|
||||
TypePointer interfaceType(bool _inLibrary) const override
|
||||
{
|
||||
return _inLibrary ? shared_from_this() : TypePointer();
|
||||
}
|
||||
virtual bool dataStoredIn(DataLocation _location) const override { return _location == DataLocation::Storage; }
|
||||
bool dataStoredIn(DataLocation _location) const override { return _location == DataLocation::Storage; }
|
||||
/// Cannot be stored in memory, but just in case.
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
|
||||
TypePointer const& keyType() const { return m_keyType; }
|
||||
TypePointer const& valueType() const { return m_valueType; }
|
||||
@@ -1225,20 +1225,20 @@ private:
|
||||
class TypeType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::TypeType; }
|
||||
Category category() const override { return Category::TypeType; }
|
||||
explicit TypeType(TypePointer const& _actualType): m_actualType(_actualType) {}
|
||||
TypePointer const& actualType() const { return m_actualType; }
|
||||
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual u256 storageSize() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual unsigned sizeOnStack() const override;
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
virtual std::string toString(bool _short) const override { return "type(" + m_actualType->toString(_short) + ")"; }
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
bool canBeStored() const override { return false; }
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
unsigned sizeOnStack() const override;
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
std::string toString(bool _short) const override { return "type(" + m_actualType->toString(_short) + ")"; }
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
|
||||
private:
|
||||
TypePointer m_actualType;
|
||||
@@ -1251,18 +1251,18 @@ private:
|
||||
class ModifierType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Modifier; }
|
||||
Category category() const override { return Category::Modifier; }
|
||||
explicit ModifierType(ModifierDefinition const& _modifier);
|
||||
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual u256 storageSize() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual unsigned sizeOnStack() const override { return 0; }
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual std::string toString(bool _short) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
bool canBeStored() const override { return false; }
|
||||
u256 storageSize() const override;
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
unsigned sizeOnStack() const override { return 0; }
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
private:
|
||||
TypePointers m_parameterTypes;
|
||||
@@ -1276,20 +1276,20 @@ private:
|
||||
class ModuleType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::Module; }
|
||||
Category category() const override { return Category::Module; }
|
||||
|
||||
explicit ModuleType(SourceUnit const& _source): m_sourceUnit(_source) {}
|
||||
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual bool canLiveOutsideStorage() const override { return true; }
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
virtual unsigned sizeOnStack() const override { return 0; }
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
bool canBeStored() const override { return false; }
|
||||
bool canLiveOutsideStorage() const override { return true; }
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
unsigned sizeOnStack() const override { return 0; }
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
|
||||
virtual std::string toString(bool _short) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
private:
|
||||
SourceUnit const& m_sourceUnit;
|
||||
@@ -1303,24 +1303,24 @@ class MagicType: public Type
|
||||
{
|
||||
public:
|
||||
enum class Kind { Block, Message, Transaction, ABI };
|
||||
virtual Category category() const override { return Category::Magic; }
|
||||
Category category() const override { return Category::Magic; }
|
||||
|
||||
explicit MagicType(Kind _kind): m_kind(_kind) {}
|
||||
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override
|
||||
{
|
||||
return TypePointer();
|
||||
}
|
||||
|
||||
virtual std::string richIdentifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual bool canLiveOutsideStorage() const override { return true; }
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
virtual unsigned sizeOnStack() const override { return 0; }
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
std::string richIdentifier() const override;
|
||||
bool operator==(Type const& _other) const override;
|
||||
bool canBeStored() const override { return false; }
|
||||
bool canLiveOutsideStorage() const override { return true; }
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
unsigned sizeOnStack() const override { return 0; }
|
||||
MemberList::MemberMap nativeMembers(ContractDefinition const*) const override;
|
||||
|
||||
virtual std::string toString(bool _short) const override;
|
||||
std::string toString(bool _short) const override;
|
||||
|
||||
Kind kind() const { return m_kind; }
|
||||
|
||||
@@ -1335,20 +1335,20 @@ private:
|
||||
class InaccessibleDynamicType: public Type
|
||||
{
|
||||
public:
|
||||
virtual Category category() const override { return Category::InaccessibleDynamic; }
|
||||
Category category() const override { return Category::InaccessibleDynamic; }
|
||||
|
||||
virtual std::string richIdentifier() const override { return "t_inaccessible"; }
|
||||
virtual bool isImplicitlyConvertibleTo(Type const&) const override { return false; }
|
||||
virtual bool isExplicitlyConvertibleTo(Type const&) const override { return false; }
|
||||
virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual unsigned calldataEncodedSize(bool _padded) const override { (void)_padded; return 32; }
|
||||
virtual bool canBeStored() const override { return false; }
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
virtual unsigned sizeOnStack() const override { return 1; }
|
||||
virtual bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
virtual std::string toString(bool) const override { return "inaccessible dynamic type"; }
|
||||
virtual TypePointer decodingType() const override { return std::make_shared<IntegerType>(256); }
|
||||
std::string richIdentifier() const override { return "t_inaccessible"; }
|
||||
bool isImplicitlyConvertibleTo(Type const&) const override { return false; }
|
||||
bool isExplicitlyConvertibleTo(Type const&) const override { return false; }
|
||||
TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); }
|
||||
unsigned calldataEncodedSize(bool _padded) const override { (void)_padded; return 32; }
|
||||
bool canBeStored() const override { return false; }
|
||||
bool canLiveOutsideStorage() const override { return false; }
|
||||
bool isValueType() const override { return true; }
|
||||
unsigned sizeOnStack() const override { return 1; }
|
||||
bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); }
|
||||
std::string toString(bool) const override { return "inaccessible dynamic type"; }
|
||||
TypePointer decodingType() const override { return std::make_shared<IntegerType>(256); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user