Merge identifier query methods into one

This commit is contained in:
Marenz
2022-02-08 17:44:21 +01:00
parent 9e62f21b25
commit 3e7c68d9b0
9 changed files with 43 additions and 48 deletions
+10 -12
View File
@@ -270,25 +270,23 @@ void CommandLineInterface::handleSignatureHashes(string const& _contract)
if (!m_options.compiler.outputs.signatureHashes)
return;
Json::Value methodIdentifiers = m_compiler->methodIdentifiers(_contract);
Json::Value contractIdentifiers = m_compiler->contractIdentifiers(_contract);
string out = "Function signatures:\n";
for (auto const& name: methodIdentifiers.getMemberNames())
out += methodIdentifiers[name].asString() + ": " + name + "\n";
for (auto const& name: contractIdentifiers["methods"].getMemberNames())
out += contractIdentifiers["methods"][name].asString() + ": " + name + "\n";
Json::Value errorIdentifiers = m_compiler->errorIdentifiers(_contract);
if (!errorIdentifiers.empty())
if (contractIdentifiers.isMember("errors"))
{
out += "\nError signatures:\n";
for (auto const& name: errorIdentifiers.getMemberNames())
out += errorIdentifiers[name].asString() + ": " + name + "\n";
for (auto const& name: contractIdentifiers["errors"].getMemberNames())
out += contractIdentifiers["errors"][name].asString() + ": " + name + "\n";
}
Json::Value eventIdentifiers = m_compiler->eventIdentifiers(_contract);
if (!eventIdentifiers.empty())
if (contractIdentifiers.isMember("events"))
{
out += "\nEvent signatures:\n";
for (auto const& name: eventIdentifiers.getMemberNames())
out += eventIdentifiers[name].asString() + ": " + name + "\n";
for (auto const& name: contractIdentifiers["events"].getMemberNames())
out += contractIdentifiers["events"][name].asString() + ": " + name + "\n";
}
if (!m_options.output.dir.empty())
@@ -838,7 +836,7 @@ void CommandLineInterface::handleCombinedJSON()
m_compiler->runtimeObject(contractName).functionDebugData
);
if (m_options.compiler.combinedJsonRequests->signatureHashes)
contractData[g_strSignatureHashes] = m_compiler->methodIdentifiers(contractName);
contractData[g_strSignatureHashes] = m_compiler->contractIdentifiers(contractName)["methods"];
if (m_options.compiler.combinedJsonRequests->natspecDev)
contractData[g_strNatspecDev] = m_compiler->natspecDev(contractName);
if (m_options.compiler.combinedJsonRequests->natspecUser)