Code generator for function types.

This commit is contained in:
chriseth
2016-11-16 14:37:17 +01:00
parent cc8583ec7d
commit dd173f83e3
6 changed files with 127 additions and 3 deletions
+11 -1
View File
@@ -2065,6 +2065,16 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con
}
}
TypePointer FunctionType::encodingType() const
{
// Only external functions can be encoded, internal functions cannot leave code boundaries.
if (m_location == Location::External)
// This looks like bytes24, but bytes24 is stored differently on the stack.
return shared_from_this();
else
return TypePointer();
}
TypePointer FunctionType::interfaceType(bool _inLibrary) const
{
if (m_location != Location::External && m_location != Location::Internal)
@@ -2072,7 +2082,7 @@ TypePointer FunctionType::interfaceType(bool _inLibrary) const
if (_inLibrary)
return shared_from_this();
else
return make_shared<FixedBytesType>(storageBytes());
return make_shared<IntegerType>(8 * storageBytes());
}
bool FunctionType::canTakeArguments(TypePointers const& _argumentTypes, TypePointer const& _selfType) const
+1
View File
@@ -901,6 +901,7 @@ public:
virtual bool canLiveOutsideStorage() const override { return m_location == Location::Internal || m_location == Location::External; }
virtual unsigned sizeOnStack() const override;
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
virtual TypePointer encodingType() const override;
virtual TypePointer interfaceType(bool _inLibrary) const override;
/// @returns TypePointer of a new FunctionType object. All input/return parameters are an