diff options
author | Christian <c@ethdev.com> | 2015-02-10 17:45:57 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-10 17:59:23 +0800 |
commit | cf4144b70246b53589b3238213f688244485f9b0 (patch) | |
tree | deb3cb5c3b8c8ebd3424338c727a1af6e84309cf /Types.cpp | |
parent | bb6f181d7dacfd1d7a070483500937004bea995c (diff) | |
download | dexon-solidity-cf4144b70246b53589b3238213f688244485f9b0.tar.gz dexon-solidity-cf4144b70246b53589b3238213f688244485f9b0.tar.zst dexon-solidity-cf4144b70246b53589b3238213f688244485f9b0.zip |
Arbitrary parameters for call() and all hash functions.
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -210,10 +210,7 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe const MemberList IntegerType::AddressMemberList = MemberList({{"balance", make_shared<IntegerType >(256)}, - {"callstring32", make_shared<FunctionType>(strings{"string32"}, strings{}, - FunctionType::Location::Bare)}, - {"callstring32string32", make_shared<FunctionType>(strings{"string32", "string32"}, - strings{}, FunctionType::Location::Bare)}, + {"call", make_shared<FunctionType>(strings(), strings(), FunctionType::Location::Bare, true)}, {"send", make_shared<FunctionType>(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<IntegerType const&>(_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<string, TypePointer> members{ {"gas", make_shared<FunctionType>(parseElementaryTypeVector({"uint"}), TypePointers{copyAndSetGasOrValue(true, false)}, - Location::SetGas, m_gasSet, m_valueSet)}, + Location::SetGas, false, m_gasSet, m_valueSet)}, {"value", make_shared<FunctionType>(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<FunctionType>(m_parameterTypes, m_returnParameterTypes, m_location, + m_arbitraryParameters, m_gasSet || _setGas, m_valueSet || _setValue); } |