fixed the output of the test

This commit is contained in:
Liana Husikyan 2015-04-17 15:26:12 +02:00
parent fcd3f44fd9
commit 2d62c482fd
3 changed files with 21 additions and 2 deletions

View File

@ -124,6 +124,12 @@ FunctionDefinition const* ContractDefinition::getConstructor() const
return nullptr;
}
FixedHash<4> ContractDefinition::getConstructorsInterface() const
{
return FixedHash<4>(dev::sha3(getConstructor()->externalSignature()));
//return hash;
}
FunctionDefinition const* ContractDefinition::getFallbackFunction() const
{
for (ContractDefinition const* contract: getLinearizedBaseContracts())

3
AST.h
View File

@ -281,6 +281,9 @@ public:
/// Returns the fallback function or nullptr if no fallback function was specified.
FunctionDefinition const* getFallbackFunction() const;
///@returns hash of the constructor
FixedHash<4> getConstructorsInterface() const;
private:
/// Checks that two functions defined in this contract with the same name have different
/// arguments and that there is at most one constructor.

View File

@ -38,7 +38,17 @@ std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefiniti
std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
{
Json::Value abi(Json::arrayValue);
for (auto const& it: _contractDef.getInterfaceFunctions())
auto allFunctions = _contractDef.getInterfaceFunctions();
FunctionTypePointer functionTypePointer = nullptr;
if (_contractDef.getConstructor())
{
functionTypePointer = make_shared<FunctionType>(*_contractDef.getConstructor(), false);
allFunctions.insert(make_pair(_contractDef.getConstructorsInterface(), functionTypePointer));
}
//allFunctions.insert(_contractDef.getConstructor());
for (auto it: allFunctions)
{
auto populateParameters = [](vector<string> const& _paramNames, vector<string> const& _paramTypes)
{
@ -55,7 +65,7 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
};
Json::Value method;
method["type"] = "function";
method["type"] = (functionTypePointer == it.second ? "constructor" : "function");
method["name"] = it.second->getDeclaration().getName();
method["constant"] = it.second->isConstant();
method["inputs"] = populateParameters(it.second->getParameterNames(),