aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/StandardCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-18 20:53:45 +0800
committerGitHub <noreply@github.com>2017-10-18 20:53:45 +0800
commit9cf6e910bd2b90d0c9415d9c257f85fe0c518de8 (patch)
tree6423baec5e26bbe174005c1a89d978cae15015d8 /libsolidity/interface/StandardCompiler.cpp
parentbdeb9e52a2211510644fb53df93fb98258b40a65 (diff)
parentc85c41880ad1c996517b0ae14f98678b1e6c5613 (diff)
downloaddexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.gz
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.bz2
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.lz
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.xz
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.tar.zst
dexon-solidity-9cf6e910bd2b90d0c9415d9c257f85fe0c518de8.zip
Merge pull request #3099 from ethereum/develop
Merge develop into release for 0.4.18.
Diffstat (limited to 'libsolidity/interface/StandardCompiler.cpp')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index b4fbbef9..430739ac 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -92,6 +92,22 @@ Json::Value formatErrorWithException(
return formatError(_warning, _type, _component, message, formattedMessage, location);
}
+set<string> requestedContractNames(Json::Value const& _outputSelection)
+{
+ set<string> names;
+ for (auto const& sourceName: _outputSelection.getMemberNames())
+ {
+ for (auto const& contractName: _outputSelection[sourceName].getMemberNames())
+ {
+ /// Consider the "all sources" shortcuts as requesting everything.
+ if (contractName == "*" || contractName == "")
+ return set<string>();
+ names.insert((sourceName == "*" ? "" : sourceName) + ":" + contractName);
+ }
+ }
+ return names;
+}
+
/// Returns true iff @a _hash (hex with 0x prefix) is the Keccak256 hash of the binary data in @a _content.
bool hashMatchesContent(string const& _hash, string const& _content)
{
@@ -265,6 +281,9 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
Json::Value metadataSettings = settings.get("metadata", Json::Value());
m_compilerStack.useMetadataLiteralSources(metadataSettings.get("useLiteralContent", Json::Value(false)).asBool());
+ Json::Value outputSelection = settings.get("outputSelection", Json::Value());
+ m_compilerStack.setRequestedContractNames(requestedContractNames(outputSelection));
+
auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compilerStack.scanner(_sourceName); };
try