aboutsummaryrefslogtreecommitdiffstats
path: root/Types.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-21 19:35:38 +0800
committerchriseth <c@ethdev.com>2015-04-21 21:50:37 +0800
commit8125f93b12243836a3c2edea09715a58d1cc1764 (patch)
treeaa3146a94740d74b1e16711c7829f95374457b13 /Types.h
parente4808305a17f43392e03e29546494d464c5f0895 (diff)
downloaddexon-solidity-8125f93b12243836a3c2edea09715a58d1cc1764.tar.gz
dexon-solidity-8125f93b12243836a3c2edea09715a58d1cc1764.tar.zst
dexon-solidity-8125f93b12243836a3c2edea09715a58d1cc1764.zip
Fix for Contract and Enum types as external function arguments.
Diffstat (limited to 'Types.h')
-rw-r--r--Types.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/Types.h b/Types.h
index e6d32d17..493fde54 100644
--- a/Types.h
+++ b/Types.h
@@ -404,12 +404,20 @@ public:
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
virtual TypePointer unaryOperatorResult(Token::Value _operator) const override;
virtual bool operator==(Type const& _other) const override;
+ virtual unsigned getCalldataEncodedSize(bool _padded = true) const override
+ {
+ return externalType()->getCalldataEncodedSize(_padded);
+ }
virtual unsigned getStorageBytes() const override { return 20; }
+ virtual bool canLiveOutsideStorage() const override { return true; }
virtual bool isValueType() const override { return true; }
virtual std::string toString() const override;
virtual MemberList const& getMembers() const override;
- virtual TypePointer externalType() 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; }
@@ -472,13 +480,21 @@ public:
explicit EnumType(EnumDefinition const& _enum): m_enum(_enum) {}
virtual TypePointer unaryOperatorResult(Token::Value _operator) const override;
virtual bool operator==(Type const& _other) const override;
+ virtual unsigned getCalldataEncodedSize(bool _padded = true) const override
+ {
+ return externalType()->getCalldataEncodedSize(_padded);
+ }
virtual unsigned getSizeOnStack() const override { return 1; }
virtual unsigned getStorageBytes() const override;
+ virtual bool canLiveOutsideStorage() const override { return true; }
virtual std::string toString() const override;
virtual bool isValueType() const override { return true; }
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
- virtual TypePointer externalType() 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
@@ -512,9 +528,12 @@ public:
virtual Category getCategory() const override { return Category::Function; }
- /// @returns TypePointer of a new FunctionType object. All input/return parameters are an appropriate external types of input/return parameters of current function.
- /// Returns an empty shared pointer if one of the input/return parameters does not have an externaltype.
- virtual TypePointer externalType() const override;
+ /// @returns TypePointer of a new FunctionType object. All input/return parameters are an
+ /// appropriate external types of input/return parameters of current function.
+ /// Returns an empty shared pointer if one of the input/return parameters does not have an
+ /// external type.
+ virtual FunctionTypePointer externalFunctionType() const;
+ virtual TypePointer externalType() const override { return externalFunctionType(); }
explicit FunctionType(FunctionDefinition const& _function, bool _isInternal = true);
explicit FunctionType(VariableDeclaration const& _varDecl);