diff options
author | Christian <c@ethdev.com> | 2015-01-20 04:05:47 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-20 06:35:04 +0800 |
commit | af92f98d86ba1e15e3f41ac49bb9639be1ab4e41 (patch) | |
tree | e42cff46c9701491a43e58bebd8ead5b3e5241ec /NameAndTypeResolver.cpp | |
parent | 6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9 (diff) | |
download | dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.gz dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.zst dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.zip |
Constructor arguments for base classes.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r-- | NameAndTypeResolver.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp index f208dc78..7df51566 100644 --- a/NameAndTypeResolver.cpp +++ b/NameAndTypeResolver.cpp @@ -48,7 +48,7 @@ void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract) { m_currentScope = &m_scopes[nullptr]; - for (ASTPointer<Identifier> const& baseContract: _contract.getBaseContracts()) + for (ASTPointer<InheritanceSpecifier> const& baseContract: _contract.getBaseContracts()) ReferencesResolver resolver(*baseContract, *this, &_contract, nullptr); m_currentScope = &m_scopes[&_contract]; @@ -113,18 +113,19 @@ 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}); - for (ASTPointer<Identifier> const& baseIdentifier: _contract.getBaseContracts()) + for (ASTPointer<InheritanceSpecifier> const& baseSpecifier: _contract.getBaseContracts()) { + ASTPointer<Identifier> baseName = baseSpecifier->getName(); ContractDefinition const* base = dynamic_cast<ContractDefinition const*>( - baseIdentifier->getReferencedDeclaration()); + baseName->getReferencedDeclaration()); if (!base) - BOOST_THROW_EXCEPTION(baseIdentifier->createTypeError("Contract expected.")); + 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); vector<ContractDefinition const*> const& basesBases = base->getLinearizedBaseContracts(); if (basesBases.empty()) - BOOST_THROW_EXCEPTION(baseIdentifier->createTypeError("Definition of base has to precede definition of derived contract")); + 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())); } vector<ContractDefinition const*> result = cThreeMerge(input); |