mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplify target selection code
This commit is contained in:
parent
b2023196a2
commit
3576ccf5b3
@ -161,27 +161,18 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _fil
|
|||||||
for (auto const& file: { _file, string("*") })
|
for (auto const& file: { _file, string("*") })
|
||||||
if (_outputSelection.isMember(file) && _outputSelection[file].isObject())
|
if (_outputSelection.isMember(file) && _outputSelection[file].isObject())
|
||||||
{
|
{
|
||||||
if (_contract.empty())
|
/// For SourceUnit-level targets (such as AST) only allow empty name, otherwise
|
||||||
{
|
/// for Contract-level targets try both contract name and wildcard
|
||||||
/// Special case for SourceUnit-level targets (such as AST)
|
vector<string> contracts{ _contract };
|
||||||
|
if (!_contract.empty())
|
||||||
|
contracts.push_back("*");
|
||||||
|
for (auto const& contract: contracts)
|
||||||
if (
|
if (
|
||||||
_outputSelection[file].isMember("") &&
|
_outputSelection[file].isMember(contract) &&
|
||||||
_outputSelection[file][""].isArray() &&
|
_outputSelection[file][contract].isArray() &&
|
||||||
isArtifactRequested(_outputSelection[file][""], _artifact)
|
isArtifactRequested(_outputSelection[file][contract], _artifact)
|
||||||
)
|
)
|
||||||
return true;
|
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;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user