mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Alethzero: Showing a contract's function's hashes at creation
This commit is contained in:
parent
c5d14ce933
commit
a253abf062
@ -179,6 +179,24 @@ string const& CompilerStack::getMetadata(string const& _contractName, Documentat
|
|||||||
return *(*doc);
|
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
|
Scanner const& CompilerStack::getScanner(string const& _sourceName) const
|
||||||
{
|
{
|
||||||
return *getSource(_sourceName).scanner;
|
return *getSource(_sourceName).scanner;
|
||||||
|
@ -93,6 +93,9 @@ public:
|
|||||||
/// Can be one of 4 types defined at @c DocumentationType
|
/// Can be one of 4 types defined at @c DocumentationType
|
||||||
std::string const& getMetadata(std::string const& _contractName, DocumentationType _type) const;
|
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.
|
/// @returns the previously used scanner, useful for counting lines during error reporting.
|
||||||
Scanner const& getScanner(std::string const& _sourceName = "") const;
|
Scanner const& getScanner(std::string const& _sourceName = "") const;
|
||||||
/// @returns the parsed source unit with the supplied name.
|
/// @returns the parsed source unit with the supplied name.
|
||||||
|
Loading…
Reference in New Issue
Block a user