diff options
author | chriseth <c@ethdev.com> | 2015-02-09 19:02:17 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-02-09 19:02:17 +0800 |
commit | d84d9d3ecd18bea9eef04fde806bf07065183a5a (patch) | |
tree | 0dfceb707f1f0ee77a5356374dde299d0cc3a66a /AST.cpp | |
parent | 75a5c20f541a7dc41f80bdb3b4fe3478d18ad4fe (diff) | |
parent | 106cda74f8f017d1a463a4bbb8f1309d7647a5d1 (diff) | |
download | dexon-solidity-d84d9d3ecd18bea9eef04fde806bf07065183a5a.tar.gz dexon-solidity-d84d9d3ecd18bea9eef04fde806bf07065183a5a.tar.zst dexon-solidity-d84d9d3ecd18bea9eef04fde806bf07065183a5a.zip |
Merge pull request #981 from chriseth/sol_cleanup
Small cleanup.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -486,7 +486,7 @@ void FunctionCall::checkTypeRequirements() if (m_arguments.size() != 1) BOOST_THROW_EXCEPTION(createTypeError("More than one argument for explicit type conversion.")); if (!m_names.empty()) - BOOST_THROW_EXCEPTION(createTypeError("Type conversion can't allow named arguments.")); + BOOST_THROW_EXCEPTION(createTypeError("Type conversion cannot allow named arguments.")); if (!m_arguments.front()->getType()->isExplicitlyConvertibleTo(*type.getActualType())) BOOST_THROW_EXCEPTION(createTypeError("Explicit type conversion not allowed.")); m_type = type.getActualType(); @@ -504,24 +504,22 @@ void FunctionCall::checkTypeRequirements() { for (size_t i = 0; i < m_arguments.size(); ++i) if (functionType->getLocation() != FunctionType::Location::SHA3 && - !m_arguments[i]->getType()->isImplicitlyConvertibleTo(*parameterTypes[i])) - BOOST_THROW_EXCEPTION(createTypeError("Invalid type for argument in function call.")); + !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 can't be used for SHA3.")); else { + if (functionType->getLocation() == FunctionType::Location::SHA3) + BOOST_THROW_EXCEPTION(createTypeError("Named arguments cannnot be used for SHA3.")); auto const& parameterNames = functionType->getParameterNames(); if (parameterNames.size() != m_names.size()) BOOST_THROW_EXCEPTION(createTypeError("Some argument names are missing.")); // check duplicate names - for (size_t i = 0; i < m_names.size(); i++) { - for (size_t j = i + 1; j < m_names.size(); j++) { + for (size_t i = 0; i < m_names.size(); i++) + for (size_t j = i + 1; j < m_names.size(); j++) if (*m_names[i] == *m_names[j]) - BOOST_THROW_EXCEPTION(createTypeError("Duplicate named argument.")); - } - } + BOOST_THROW_EXCEPTION(m_arguments[i]->createTypeError("Duplicate named argument.")); for (size_t i = 0; i < m_names.size(); i++) { bool found = false; @@ -536,7 +534,7 @@ void FunctionCall::checkTypeRequirements() } } if (!found) - BOOST_THROW_EXCEPTION(createTypeError("Named argument doesn't match function declaration.")); + BOOST_THROW_EXCEPTION(createTypeError("Named argument does not match function declaration.")); } } |