aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-20 17:21:59 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-20 22:09:52 +0800
commit7887045a48545038298dbf7790a20a406b93f155 (patch)
tree46132245e244838093ea82960b12184e40d2ecfa
parentff9039b2a82f5679cb79bf0a47f280283554ba89 (diff)
downloaddexon-solidity-7887045a48545038298dbf7790a20a406b93f155.tar
dexon-solidity-7887045a48545038298dbf7790a20a406b93f155.tar.gz
dexon-solidity-7887045a48545038298dbf7790a20a406b93f155.tar.bz2
dexon-solidity-7887045a48545038298dbf7790a20a406b93f155.tar.lz
dexon-solidity-7887045a48545038298dbf7790a20a406b93f155.tar.xz
dexon-solidity-7887045a48545038298dbf7790a20a406b93f155.tar.zst
dexon-solidity-7887045a48545038298dbf7790a20a406b93f155.zip
ast: simplifications suggested by @chriseth
-rw-r--r--libsolidity/ast/Types.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index b28ae482..a412d421 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -23,6 +23,7 @@
#include <libsolidity/ast/Types.h>
#include <limits>
#include <boost/range/adaptor/reversed.hpp>
+#include <boost/range/adaptor/sliced.hpp>
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/SHA3.h>
@@ -1325,13 +1326,9 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con
{
// add the most derived of all functions which are visible in derived contracts
auto bases = m_contract.annotation().linearizedBaseContracts;
- if (bases.size() < 1)
- BOOST_THROW_EXCEPTION(
- InternalCompilerError() <<
- errinfo_comment("linearizedBaseContracts should at least contain the most derived contract.")
- );
- bases.erase(bases.begin()); // Remove the most derived contract, which should not be searchable from `super`.
- for (ContractDefinition const* base: bases)
+ solAssert(bases.size() >= 1, "linearizedBaseContracts should at least contain the most derived contract.");
+ // `sliced(1, ...)` ignores the most derived contract, which should not be searchable from `super`.
+ for (ContractDefinition const* base: bases | boost::adaptors::sliced(1, bases.size()))
for (FunctionDefinition const* function: base->definedFunctions())
{
if (!function->isVisibleInDerivedContracts())