mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixed the output of the test
This commit is contained in:
parent
fcd3f44fd9
commit
2d62c482fd
6
AST.cpp
6
AST.cpp
@ -124,6 +124,12 @@ FunctionDefinition const* ContractDefinition::getConstructor() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FixedHash<4> ContractDefinition::getConstructorsInterface() const
|
||||||
|
{
|
||||||
|
return FixedHash<4>(dev::sha3(getConstructor()->externalSignature()));
|
||||||
|
//return hash;
|
||||||
|
}
|
||||||
|
|
||||||
FunctionDefinition const* ContractDefinition::getFallbackFunction() const
|
FunctionDefinition const* ContractDefinition::getFallbackFunction() const
|
||||||
{
|
{
|
||||||
for (ContractDefinition const* contract: getLinearizedBaseContracts())
|
for (ContractDefinition const* contract: getLinearizedBaseContracts())
|
||||||
|
3
AST.h
3
AST.h
@ -281,6 +281,9 @@ public:
|
|||||||
/// Returns the fallback function or nullptr if no fallback function was specified.
|
/// Returns the fallback function or nullptr if no fallback function was specified.
|
||||||
FunctionDefinition const* getFallbackFunction() const;
|
FunctionDefinition const* getFallbackFunction() const;
|
||||||
|
|
||||||
|
///@returns hash of the constructor
|
||||||
|
FixedHash<4> getConstructorsInterface() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Checks that two functions defined in this contract with the same name have different
|
/// Checks that two functions defined in this contract with the same name have different
|
||||||
/// arguments and that there is at most one constructor.
|
/// arguments and that there is at most one constructor.
|
||||||
|
@ -38,7 +38,17 @@ std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefiniti
|
|||||||
std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
|
std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
|
||||||
{
|
{
|
||||||
Json::Value abi(Json::arrayValue);
|
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)
|
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;
|
Json::Value method;
|
||||||
method["type"] = "function";
|
method["type"] = (functionTypePointer == it.second ? "constructor" : "function");
|
||||||
method["name"] = it.second->getDeclaration().getName();
|
method["name"] = it.second->getDeclaration().getName();
|
||||||
method["constant"] = it.second->isConstant();
|
method["constant"] = it.second->isConstant();
|
||||||
method["inputs"] = populateParameters(it.second->getParameterNames(),
|
method["inputs"] = populateParameters(it.second->getParameterNames(),
|
||||||
|
Loading…
Reference in New Issue
Block a user