diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index ca76d023c..38adebf9d 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -519,17 +519,6 @@ void Literal::checkTypeRequirements() BOOST_THROW_EXCEPTION(createTypeError("Invalid literal value.")); } - -bool ParamDescription::operator!=(ParamDescription const& _other) const -{ - return m_description.first == _other.getName() && m_description.second == _other.getType(); -} - -std::ostream& ParamDescription::operator<<(std::ostream& os) const -{ - return os << m_description.first << ":" << m_description.second; -} - std::string ParamDescription::getName() const { return m_description.first; @@ -540,7 +529,6 @@ std::string ParamDescription::getType() const return m_description.second; } - ASTPointer FunctionDescription::getDocumentation() const { auto function = dynamic_cast(m_description.second); @@ -575,7 +563,7 @@ vector const FunctionDescription::getParameters() const if (function) { vector paramsDescription; - for (auto const& param: function->getParameters()) + for (auto const& param: function->getReturnParameters()) paramsDescription.push_back(ParamDescription(param->getName(), param->getType()->toString())); return paramsDescription; diff --git a/libsolidity/AST.h b/libsolidity/AST.h index bda06a5db..d9a95e506 100755 --- a/libsolidity/AST.h +++ b/libsolidity/AST.h @@ -166,9 +166,6 @@ struct ParamDescription ParamDescription(std::string const& _name, std::string const& _type): m_description(_name, _type){} - bool operator!=(ParamDescription const& _other) const; - std::ostream& operator<<(std::ostream& os) const; - std::string getName() const; std::string getType() const; diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index c5f1a3ae5..812271e30 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -606,7 +606,7 @@ FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal } FunctionType::FunctionType(VariableDeclaration const& _varDecl): - m_location(Location::INTERNAL) + m_location(Location::EXTERNAL) { TypePointers params; vector paramNames; diff --git a/libsolidity/Types.h b/libsolidity/Types.h index b26157b3e..2dbed95fa 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -378,7 +378,7 @@ public: virtual MemberList const& getMembers() const override; Location const& getLocation() const { return m_location; } - std::string getCanonicalSignature(std::string const &_name) const; + std::string getCanonicalSignature(std::string const& _name) const; bool gasSet() const { return m_gasSet; } bool valueSet() const { return m_valueSet; } diff --git a/test/SolidityNameAndTypeResolution.cpp b/test/SolidityNameAndTypeResolution.cpp index dbb95cf72..3b711bfec 100644 --- a/test/SolidityNameAndTypeResolution.cpp +++ b/test/SolidityNameAndTypeResolution.cpp @@ -645,9 +645,9 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) BOOST_CHECK((contract = retrieveContract(source, 0)) != nullptr); FunctionDescription function = retrieveFunctionBySignature(contract, "foo()"); BOOST_CHECK_MESSAGE(function.getDeclaration() != nullptr, "Could not find the accessor function"); - // vector const expected({ParamDescription("", "uint256")}); - // BOOST_CHECK_EQUAL_COLLECTIONS(function.getReturnParameters().begin(), function.getReturnParameters().end(), - // expected.begin(), expected.end()); + auto returnParams = function.getReturnParameters(); + BOOST_CHECK_EQUAL(returnParams.at(0).getType(), "uint256"); + BOOST_CHECK(function.isConstant()); } BOOST_AUTO_TEST_CASE(private_state_variable) diff --git a/test/SolidityParser.cpp b/test/SolidityParser.cpp index db7806f4d..7bfb4c0c8 100644 --- a/test/SolidityParser.cpp +++ b/test/SolidityParser.cpp @@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(multiline_function_documentation) BOOST_REQUIRE_NO_THROW(contract = parseText(text)); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(1)); // 1 since, 0 is the index of stateVar accessor + BOOST_REQUIRE_NO_THROW(function = functions.at(0)); checkFunctionNatspec(function, "This is a test function\n" " and it has 2 lines"); }