From 819d9fd5a665d33f5c3b08ddf50eca3426c28e01 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 30 Mar 2015 15:14:59 +0200 Subject: Detect if non-existant parameter is documented with natspec --- InterfaceHandler.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp index 2f35a96f..aacbbfd7 100644 --- a/InterfaceHandler.cpp +++ b/InterfaceHandler.cpp @@ -175,8 +175,17 @@ std::unique_ptr InterfaceHandler::getDevDocumentation(ContractDefin method["author"] = m_author; Json::Value params(Json::objectValue); + std::vector paramNames = it.second->getParameterNames(); 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; + } if (!m_params.empty()) method["params"] = params; -- cgit v1.2.3