mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1464 from LefterisJP/natspec_nonexistant_param
Detect if non-existant parameter is documented with natspec
This commit is contained in:
commit
7dbc2bcf20
@ -175,8 +175,17 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin
|
|||||||
method["author"] = m_author;
|
method["author"] = m_author;
|
||||||
|
|
||||||
Json::Value params(Json::objectValue);
|
Json::Value params(Json::objectValue);
|
||||||
|
std::vector<std::string> paramNames = it.second->getParameterNames();
|
||||||
for (auto const& pair: m_params)
|
for (auto const& pair: m_params)
|
||||||
|
{
|
||||||
|
if (find(paramNames.begin(), paramNames.end(), pair.first) == paramNames.end())
|
||||||
|
// LTODO: mismatching parameter name, throw some form of warning and not just an exception
|
||||||
|
BOOST_THROW_EXCEPTION(
|
||||||
|
DocstringParsingError() <<
|
||||||
|
errinfo_comment("documented parameter \"" + pair.first + "\" not found found in the function")
|
||||||
|
);
|
||||||
params[pair.first] = pair.second;
|
params[pair.first] = pair.second;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_params.empty())
|
if (!m_params.empty())
|
||||||
method["params"] = params;
|
method["params"] = params;
|
||||||
|
Loading…
Reference in New Issue
Block a user