diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-13 07:47:15 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-19 21:56:40 +0800 |
commit | c617336587b976afc3dbe388ebaa8605c3d6fe54 (patch) | |
tree | ef4cb11997d22a005124fc50f176b0127d1fb625 /libsolidity | |
parent | ed592d6ccb9a8a088dc8153baae78f771304a257 (diff) | |
download | dexon-solidity-c617336587b976afc3dbe388ebaa8605c3d6fe54.tar.gz dexon-solidity-c617336587b976afc3dbe388ebaa8605c3d6fe54.tar.zst dexon-solidity-c617336587b976afc3dbe388ebaa8605c3d6fe54.zip |
Only include files usde in metadata
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 7a87875c..9b630c31 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -780,9 +780,18 @@ string CompilerStack::createMetadata(Contract const& _contract) const meta["language"] = "Solidity"; meta["compiler"]["version"] = VersionStringStrict; + /// All the source files (including self), which should be included in the metadata. + set<string> referencedSources; + referencedSources.insert(_contract.contract->sourceUnit().annotation().path); + for (auto const sourceUnit: _contract.contract->sourceUnit().referencedSourceUnits(true)) + referencedSources.insert(sourceUnit->annotation().path); + meta["sources"] = Json::objectValue; for (auto const& s: m_sources) { + if (!referencedSources.count(s.first)) + continue; + solAssert(s.second.scanner, "Scanner not available"); meta["sources"][s.first]["keccak256"] = "0x" + toHex(dev::keccak256(s.second.scanner->source()).asBytes()); |