aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-10 17:45:57 +0800
committerChristian <c@ethdev.com>2015-02-10 17:59:23 +0800
commitcf4144b70246b53589b3238213f688244485f9b0 (patch)
treedeb3cb5c3b8c8ebd3424338c727a1af6e84309cf /AST.cpp
parentbb6f181d7dacfd1d7a070483500937004bea995c (diff)
downloaddexon-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.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/AST.cpp b/AST.cpp
index 86f54e25..041b6277 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -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."));