aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-11-22 21:35:01 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-11-30 04:10:18 +0800
commit3576ccf5b36f41d36898919eee7316b9c7c49d41 (patch)
tree9fd60dbbca353908826b79cb49320940d89cc8d8 /libsolidity
parentb2023196a295a0e41bdc5c2b848b5c09fc581691 (diff)
downloaddexon-solidity-3576ccf5b36f41d36898919eee7316b9c7c49d41.tar.gz
dexon-solidity-3576ccf5b36f41d36898919eee7316b9c7c49d41.tar.zst
dexon-solidity-3576ccf5b36f41d36898919eee7316b9c7c49d41.zip
Simplify target selection code
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 6fb70584..ad01821e 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -161,27 +161,18 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _fil
for (auto const& file: { _file, string("*") })
if (_outputSelection.isMember(file) && _outputSelection[file].isObject())
{
- if (_contract.empty())
- {
- /// Special case for SourceUnit-level targets (such as AST)
+ /// For SourceUnit-level targets (such as AST) only allow empty name, otherwise
+ /// for Contract-level targets try both contract name and wildcard
+ vector<string> contracts{ _contract };
+ if (!_contract.empty())
+ contracts.push_back("*");
+ for (auto const& contract: contracts)
if (
- _outputSelection[file].isMember("") &&
- _outputSelection[file][""].isArray() &&
- isArtifactRequested(_outputSelection[file][""], _artifact)
+ _outputSelection[file].isMember(contract) &&
+ _outputSelection[file][contract].isArray() &&
+ isArtifactRequested(_outputSelection[file][contract], _artifact)
)
return true;
- }
- else
- {
- /// Regular case for Contract-level targets
- for (auto const& contract: { _contract, string("*") })
- if (
- _outputSelection[file].isMember(contract) &&
- _outputSelection[file][contract].isArray() &&
- isArtifactRequested(_outputSelection[file][contract], _artifact)
- )
- return true;
- }
}
return false;