mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
ast: simplifications suggested by @chriseth
This commit is contained in:
parent
ff9039b2a8
commit
7887045a48
@ -23,6 +23,7 @@
|
|||||||
#include <libsolidity/ast/Types.h>
|
#include <libsolidity/ast/Types.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <boost/range/adaptor/reversed.hpp>
|
#include <boost/range/adaptor/reversed.hpp>
|
||||||
|
#include <boost/range/adaptor/sliced.hpp>
|
||||||
#include <libdevcore/CommonIO.h>
|
#include <libdevcore/CommonIO.h>
|
||||||
#include <libdevcore/CommonData.h>
|
#include <libdevcore/CommonData.h>
|
||||||
#include <libdevcore/SHA3.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
|
// add the most derived of all functions which are visible in derived contracts
|
||||||
auto bases = m_contract.annotation().linearizedBaseContracts;
|
auto bases = m_contract.annotation().linearizedBaseContracts;
|
||||||
if (bases.size() < 1)
|
solAssert(bases.size() >= 1, "linearizedBaseContracts should at least contain the most derived contract.");
|
||||||
BOOST_THROW_EXCEPTION(
|
// `sliced(1, ...)` ignores the most derived contract, which should not be searchable from `super`.
|
||||||
InternalCompilerError() <<
|
for (ContractDefinition const* base: bases | boost::adaptors::sliced(1, bases.size()))
|
||||||
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)
|
|
||||||
for (FunctionDefinition const* function: base->definedFunctions())
|
for (FunctionDefinition const* function: base->definedFunctions())
|
||||||
{
|
{
|
||||||
if (!function->isVisibleInDerivedContracts())
|
if (!function->isVisibleInDerivedContracts())
|
||||||
|
Loading…
Reference in New Issue
Block a user