mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Function signatures containing structs.
This commit is contained in:
committed by
Alex Beregszaszi
parent
22f85d5af3
commit
080be885f8
+19
-9
@@ -245,9 +245,15 @@ public:
|
||||
|
||||
virtual std::string toString(bool _short) const = 0;
|
||||
std::string toString() const { return toString(false); }
|
||||
/// @returns the canonical name of this type for use in function signatures.
|
||||
/// @param _addDataLocation if true, includes data location for reference types if it is "storage".
|
||||
virtual std::string canonicalName(bool /*_addDataLocation*/) const { return toString(true); }
|
||||
/// @returns the canonical name of this type for use in library function signatures.
|
||||
virtual std::string canonicalName() const { return toString(true); }
|
||||
/// @returns the signature of this type in external functions, i.e. `uint256` for integers
|
||||
/// or `(uint256, bytes8)[2]` for an array of structs. If @a _structsByName,
|
||||
/// structs are given by canonical name like `ContractName.StructName[2]`.
|
||||
virtual std::string signatureInExternalFunction(bool /*_structsByName*/) const
|
||||
{
|
||||
return canonicalName();
|
||||
}
|
||||
virtual u256 literalValue(Literal const*) const
|
||||
{
|
||||
solAssert(false, "Literal value requested for type without literals.");
|
||||
@@ -619,7 +625,8 @@ public:
|
||||
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(bool _addDataLocation) 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;
|
||||
@@ -677,7 +684,7 @@ public:
|
||||
virtual unsigned sizeOnStack() const override { return m_super ? 0 : 1; }
|
||||
virtual bool isValueType() const override { return true; }
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName(bool _addDataLocation) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
|
||||
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
|
||||
virtual TypePointer encodingType() const override
|
||||
@@ -744,7 +751,8 @@ public:
|
||||
|
||||
TypePointer copyForLocation(DataLocation _location, bool _isPointer) const override;
|
||||
|
||||
virtual std::string canonicalName(bool _addDataLocation) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual std::string signatureInExternalFunction(bool _structsByName) const override;
|
||||
|
||||
/// @returns a function that peforms the type conversion between a list of struct members
|
||||
/// and a memory struct of this type.
|
||||
@@ -755,6 +763,8 @@ public:
|
||||
|
||||
StructDefinition const& structDefinition() const { return m_struct; }
|
||||
|
||||
/// @returns the vector of types of members available in memory.
|
||||
TypePointers memoryMemberTypes() const;
|
||||
/// @returns the set of all members that are removed in the memory version (typically mappings).
|
||||
std::set<std::string> membersMissingInMemory() const;
|
||||
|
||||
@@ -784,7 +794,7 @@ public:
|
||||
virtual unsigned storageBytes() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return true; }
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName(bool _addDataLocation) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual bool isValueType() const override { return true; }
|
||||
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
@@ -955,7 +965,7 @@ public:
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token::Value _operator) const override;
|
||||
virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override;
|
||||
virtual std::string canonicalName(bool /*_addDataLocation*/) 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; }
|
||||
@@ -1057,7 +1067,7 @@ public:
|
||||
virtual std::string identifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual std::string toString(bool _short) const override;
|
||||
virtual std::string canonicalName(bool _addDataLocation) const override;
|
||||
virtual std::string canonicalName() const override;
|
||||
virtual bool canLiveOutsideStorage() const override { return false; }
|
||||
virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); }
|
||||
virtual TypePointer encodingType() const override
|
||||
|
||||
Reference in New Issue
Block a user