From 7ed938b95e3061ee6b1782e09abccf1b26092b53 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 6 Sep 2017 15:05:35 +0100 Subject: Change retrieveContract to take name and not index --- test/libsolidity/AnalysisFramework.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/libsolidity/AnalysisFramework.cpp') diff --git a/test/libsolidity/AnalysisFramework.cpp b/test/libsolidity/AnalysisFramework.cpp index 71bb4ca7..5f5f6411 100644 --- a/test/libsolidity/AnalysisFramework.cpp +++ b/test/libsolidity/AnalysisFramework.cpp @@ -106,12 +106,12 @@ void AnalysisFramework::printErrors() ); } -ContractDefinition const* AnalysisFramework::retrieveContract(SourceUnit const& _source, unsigned index) +ContractDefinition const* AnalysisFramework::retrieveContractByName(SourceUnit const& _source, string const& _name) { ContractDefinition* contract = nullptr; - unsigned counter = 0; + for (shared_ptr const& node: _source.nodes()) - if ((contract = dynamic_cast(node.get())) && counter == index) + if ((contract = dynamic_cast(node.get())) && contract->name() == _name) return contract; return nullptr; -- cgit v1.2.3