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 /AST.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 'AST.cpp')
-rw-r--r-- | AST.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -497,20 +497,21 @@ void FunctionCall::checkTypeRequirements() // and then ask if that is implicitly convertible to the struct represented by the // function parameters TypePointers const& parameterTypes = functionType->getParameterTypes(); - if (functionType->getLocation() != FunctionType::Location::SHA3 && parameterTypes.size() != m_arguments.size()) + if (!functionType->takesArbitraryParameters() && parameterTypes.size() != m_arguments.size()) BOOST_THROW_EXCEPTION(createTypeError("Wrong argument count for function call.")); if (m_names.empty()) { for (size_t i = 0; i < m_arguments.size(); ++i) - if (functionType->getLocation() != FunctionType::Location::SHA3 && + if (!functionType->takesArbitraryParameters() && !m_arguments[i]->getType()->isImplicitlyConvertibleTo(*parameterTypes[i])) BOOST_THROW_EXCEPTION(m_arguments[i]->createTypeError("Invalid type for argument in function call.")); } else { - if (functionType->getLocation() == FunctionType::Location::SHA3) - BOOST_THROW_EXCEPTION(createTypeError("Named arguments cannnot be used for SHA3.")); + if (functionType->takesArbitraryParameters()) + BOOST_THROW_EXCEPTION(createTypeError("Named arguments cannnot be used for functions " + "that take arbitrary parameters.")); auto const& parameterNames = functionType->getParameterNames(); if (parameterNames.size() != m_names.size()) BOOST_THROW_EXCEPTION(createTypeError("Some argument names are missing.")); |