aboutsummaryrefslogtreecommitdiffstats
path: root/InterfaceHandler.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-07 23:39:21 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-07 23:39:21 +0800
commitc55608f94b834d5286c4b638dd4daa77cf406807 (patch)
treefb60c5c2a916e8fa1b4e06915bd233f81cb8bd08 /InterfaceHandler.cpp
parentdf0dce584d2d1aacf3d33658b0540f243b3adb81 (diff)
downloaddexon-solidity-c55608f94b834d5286c4b638dd4daa77cf406807.tar.gz
dexon-solidity-c55608f94b834d5286c4b638dd4daa77cf406807.tar.zst
dexon-solidity-c55608f94b834d5286c4b638dd4daa77cf406807.zip
Solidity getInterfaceFunctions is now a map of hash to Function
- Also introduced dependency between libsolidity and libdevcrypto - Compler's appendFunctionSelector now has a first version of using function signature hash instead of index
Diffstat (limited to 'InterfaceHandler.cpp')
-rw-r--r--InterfaceHandler.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp
index 224234cb..0843c363 100644
--- a/InterfaceHandler.cpp
+++ b/InterfaceHandler.cpp
@@ -35,8 +35,9 @@ std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefiniti
std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
{
Json::Value methods(Json::arrayValue);
+ auto interfaceFunctions = _contractDef.getInterfaceFunctions();
- for (FunctionDefinition const* f: _contractDef.getInterfaceFunctions())
+ for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it)
{
Json::Value method;
Json::Value inputs(Json::arrayValue);
@@ -55,10 +56,10 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
return params;
};
- method["name"] = f->getName();
- method["constant"] = f->isDeclaredConst();
- method["inputs"] = populateParameters(f->getParameters());
- method["outputs"] = populateParameters(f->getReturnParameters());
+ method["name"] = it->second->getName();
+ method["constant"] = it->second->isDeclaredConst();
+ method["inputs"] = populateParameters(it->second->getParameters());
+ method["outputs"] = populateParameters(it->second->getReturnParameters());
methods.append(method);
}
return std::unique_ptr<std::string>(new std::string(m_writer.write(methods)));
@@ -68,11 +69,12 @@ std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefi
{
Json::Value doc;
Json::Value methods(Json::objectValue);
+ auto interfaceFunctions = _contractDef.getInterfaceFunctions();
- for (FunctionDefinition const* f: _contractDef.getInterfaceFunctions())
+ for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it)
{
Json::Value user;
- auto strPtr = f->getDocumentation();
+ auto strPtr = it->second->getDocumentation();
if (strPtr)
{
resetUser();
@@ -80,7 +82,7 @@ std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefi
if (!m_notice.empty())
{// since @notice is the only user tag if missing function should not appear
user["notice"] = Json::Value(m_notice);
- methods[f->getName()] = user;
+ methods[it->second->getName()] = user;
}
}
}
@@ -110,10 +112,11 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin
doc["title"] = m_title;
}
- for (FunctionDefinition const* f: _contractDef.getInterfaceFunctions())
+ auto interfaceFunctions = _contractDef.getInterfaceFunctions();
+ for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it)
{
Json::Value method;
- auto strPtr = f->getDocumentation();
+ auto strPtr = it->second->getDocumentation();
if (strPtr)
{
resetDev();
@@ -136,7 +139,7 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin
method["return"] = m_return;
if (!method.empty()) // add the function, only if we have any documentation to add
- methods[f->getName()] = method;
+ methods[it->second->getName()] = method;
}
}
doc["methods"] = methods;