mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Only include files usde in metadata
This commit is contained in:
parent
ed592d6ccb
commit
c617336587
@ -4,6 +4,7 @@ Features:
|
||||
* C API (``jsonCompiler``): Export the ``license`` method.
|
||||
* Inline Assembly: Show useful error message if trying to access calldata variables.
|
||||
* Inline Assembly: Support variable declaration without initial value (defaults to 0).
|
||||
* Metadata: Only include files which were used to compile the given contract.
|
||||
* Type Checker: Disallow value transfers to contracts without a payable fallback function.
|
||||
* Type Checker: Include types in explicit conversion error message.
|
||||
* Type Checker: Raise proper error for arrays too large for ABI encoding.
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user