diff options
author | Christian <c@ethdev.com> | 2015-01-26 17:20:46 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-26 17:20:46 +0800 |
commit | fe37aad4d52f2ddd3d9fd6f6249a9a94394eaf1c (patch) | |
tree | 19e682c64d71156624b71cbad652adde89e5bcd6 /NameAndTypeResolver.cpp | |
parent | 570e49c03ab9e09d538218839696fc6159b0a2f1 (diff) | |
download | dexon-solidity-fe37aad4d52f2ddd3d9fd6f6249a9a94394eaf1c.tar.gz dexon-solidity-fe37aad4d52f2ddd3d9fd6f6249a9a94394eaf1c.tar.zst dexon-solidity-fe37aad4d52f2ddd3d9fd6f6249a9a94394eaf1c.zip |
Reverse order of inheritance in base list.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r-- | NameAndTypeResolver.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp index ba5ca134..c67cd727 100644 --- a/NameAndTypeResolver.cpp +++ b/NameAndTypeResolver.cpp @@ -111,7 +111,7 @@ void NameAndTypeResolver::linearizeBaseContracts(ContractDefinition& _contract) { // order in the lists is from derived to base // list of lists to linearize, the last element is the list of direct bases - list<list<ContractDefinition const*>> input(1, {&_contract}); + list<list<ContractDefinition const*>> input(1, {}); for (ASTPointer<InheritanceSpecifier> const& baseSpecifier: _contract.getBaseContracts()) { ASTPointer<Identifier> baseName = baseSpecifier->getName(); @@ -119,14 +119,15 @@ void NameAndTypeResolver::linearizeBaseContracts(ContractDefinition& _contract) baseName->getReferencedDeclaration()); if (!base) BOOST_THROW_EXCEPTION(baseName->createTypeError("Contract expected.")); - // "push_back" has the effect that bases mentioned earlier can overwrite members of bases - // mentioned later - input.back().push_back(base); + // "push_front" has the effect that bases mentioned later can overwrite members of bases + // mentioned earlier + input.back().push_front(base); vector<ContractDefinition const*> const& basesBases = base->getLinearizedBaseContracts(); if (basesBases.empty()) BOOST_THROW_EXCEPTION(baseName->createTypeError("Definition of base has to precede definition of derived contract")); input.push_front(list<ContractDefinition const*>(basesBases.begin(), basesBases.end())); } + input.back().push_front(&_contract); vector<ContractDefinition const*> result = cThreeMerge(input); if (result.empty()) BOOST_THROW_EXCEPTION(_contract.createTypeError("Linearization of inheritance graph impossible")); |