diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-06 22:05:35 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-11 22:58:30 +0800 |
commit | 7ed938b95e3061ee6b1782e09abccf1b26092b53 (patch) | |
tree | 8a1f24a225519f8edd60fa6ec73d0202822228fd /test/libsolidity/AnalysisFramework.cpp | |
parent | fbe24da159452f8b22206b6e750174ed03b43ade (diff) | |
download | dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.tar dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.tar.gz dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.tar.bz2 dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.tar.lz dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.tar.xz dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.tar.zst dexon-solidity-7ed938b95e3061ee6b1782e09abccf1b26092b53.zip |
Change retrieveContract to take name and not index
Diffstat (limited to 'test/libsolidity/AnalysisFramework.cpp')
-rw-r--r-- | test/libsolidity/AnalysisFramework.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<ASTNode> const& node: _source.nodes()) - if ((contract = dynamic_cast<ContractDefinition*>(node.get())) && counter == index) + if ((contract = dynamic_cast<ContractDefinition*>(node.get())) && contract->name() == _name) return contract; return nullptr; |