From cf4144b70246b53589b3238213f688244485f9b0 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 10 Feb 2015 10:45:57 +0100 Subject: Arbitrary parameters for call() and all hash functions. --- Types.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Types.cpp') diff --git a/Types.cpp b/Types.cpp index 02c293b7..6fd9e8b4 100644 --- a/Types.cpp +++ b/Types.cpp @@ -210,10 +210,7 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe const MemberList IntegerType::AddressMemberList = MemberList({{"balance", make_shared(256)}, - {"callstring32", make_shared(strings{"string32"}, strings{}, - FunctionType::Location::Bare)}, - {"callstring32string32", make_shared(strings{"string32", "string32"}, - strings{}, FunctionType::Location::Bare)}, + {"call", make_shared(strings(), strings(), FunctionType::Location::Bare, true)}, {"send", make_shared(strings{"uint"}, strings{}, FunctionType::Location::Send)}}); IntegerConstantType::IntegerConstantType(Literal const& _literal) @@ -401,13 +398,16 @@ bool StaticStringType::isImplicitlyConvertibleTo(Type const& _convertTo) const bool StaticStringType::isExplicitlyConvertibleTo(Type const& _convertTo) const { + if (_convertTo.getCategory() == getCategory()) + return true; if (_convertTo.getCategory() == Category::Integer) { IntegerType const& convertTo = dynamic_cast(_convertTo); if (convertTo.isHash() && (m_bytes * 8 == convertTo.getNumBits())) return true; } - return isImplicitlyConvertibleTo(_convertTo); + + return false; } bool StaticStringType::operator==(Type const& _other) const @@ -766,10 +766,10 @@ MemberList const& FunctionType::getMembers() const map members{ {"gas", make_shared(parseElementaryTypeVector({"uint"}), TypePointers{copyAndSetGasOrValue(true, false)}, - Location::SetGas, m_gasSet, m_valueSet)}, + Location::SetGas, false, m_gasSet, m_valueSet)}, {"value", make_shared(parseElementaryTypeVector({"uint"}), TypePointers{copyAndSetGasOrValue(false, true)}, - Location::SetValue, m_gasSet, m_valueSet)}}; + Location::SetValue, false, m_gasSet, m_valueSet)}}; if (m_location == Location::Creation) members.erase("gas"); m_members.reset(new MemberList(members)); @@ -808,6 +808,7 @@ TypePointers FunctionType::parseElementaryTypeVector(strings const& _types) TypePointer FunctionType::copyAndSetGasOrValue(bool _setGas, bool _setValue) const { return make_shared(m_parameterTypes, m_returnParameterTypes, m_location, + m_arbitraryParameters, m_gasSet || _setGas, m_valueSet || _setValue); } -- cgit