diff options
author | chriseth <chris@ethereum.org> | 2017-07-27 17:07:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 17:07:15 +0800 |
commit | 1298a8df14bd3dd6495aa38413208fa77781d4fd (patch) | |
tree | 90fe3173fc7716789b47474cfb4053e4b90dd752 /libsolidity/interface/CompilerStack.cpp | |
parent | 16ca1eea78d476de3fd52ebdd9dcfb6fa5610aa6 (diff) | |
parent | 35feb6d47ce143c625187a95f54563fa456aa3f5 (diff) | |
download | dexon-solidity-1298a8df14bd3dd6495aa38413208fa77781d4fd.tar.gz dexon-solidity-1298a8df14bd3dd6495aa38413208fa77781d4fd.tar.zst dexon-solidity-1298a8df14bd3dd6495aa38413208fa77781d4fd.zip |
Merge pull request #2566 from ethereum/metadata-only-relevant
Metadata: only include relevant files in the source list
Diffstat (limited to 'libsolidity/interface/CompilerStack.cpp')
-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 d5a4e554..f06dd4d7 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -753,9 +753,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()); |