aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CompilerStack.cpp18
-rw-r--r--CompilerStack.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp
index 547e5fe2..f0d2e7f7 100644
--- a/CompilerStack.cpp
+++ b/CompilerStack.cpp
@@ -179,6 +179,24 @@ string const& CompilerStack::getMetadata(string const& _contractName, Documentat
return *(*doc);
}
+std::string const CompilerStack::getFunctionHashes(std::string const& _contractName)
+{
+ if (!m_parseSuccessful)
+ BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
+
+ std::string ret = "";
+ Contract const& contract = getContract(_contractName);
+ auto interfaceFunctions = contract.contract->getInterfaceFunctions();
+
+ for (auto const& it: interfaceFunctions)
+ {
+ ret += it.first.abridged();
+ ret += " :";
+ ret += it.second->getName() + "\n";
+ }
+ return ret;
+}
+
Scanner const& CompilerStack::getScanner(string const& _sourceName) const
{
return *getSource(_sourceName).scanner;
diff --git a/CompilerStack.h b/CompilerStack.h
index 6b60f1dd..da0adf57 100644
--- a/CompilerStack.h
+++ b/CompilerStack.h
@@ -93,6 +93,9 @@ public:
/// Can be one of 4 types defined at @c DocumentationType
std::string const& getMetadata(std::string const& _contractName, DocumentationType _type) const;
+ /// Convenience function to return all contract method hashes in a string
+ std::string const getFunctionHashes(std::string const& _contractName = "");
+
/// @returns the previously used scanner, useful for counting lines during error reporting.
Scanner const& getScanner(std::string const& _sourceName = "") const;
/// @returns the parsed source unit with the supplied name.