aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/interface/CompilerStack.cpp10
-rw-r--r--libsolidity/interface/Natspec.cpp17
-rw-r--r--libsolidity/interface/Natspec.h10
3 files changed, 6 insertions, 31 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index e2507821..8b08377b 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -451,18 +451,20 @@ Json::Value const& CompilerStack::natspec(Contract const& _contract, Documentati
{
case DocumentationType::NatspecUser:
doc = &_contract.userDocumentation;
+ // caches the result
+ if (!*doc)
+ doc->reset(new Json::Value(Natspec::userDocumentation(*_contract.contract)));
break;
case DocumentationType::NatspecDev:
doc = &_contract.devDocumentation;
+ // caches the result
+ if (!*doc)
+ doc->reset(new Json::Value(Natspec::devDocumentation(*_contract.contract)));
break;
default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type."));
}
- // caches the result
- if (!*doc)
- doc->reset(new Json::Value(Natspec::documentation(*_contract.contract, _type)));
-
return *(*doc);
}
diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp
index 70486e23..7f7084ef 100644
--- a/libsolidity/interface/Natspec.cpp
+++ b/libsolidity/interface/Natspec.cpp
@@ -26,28 +26,11 @@
#include <libsolidity/interface/Natspec.h>
#include <boost/range/irange.hpp>
#include <libsolidity/ast/AST.h>
-#include <libsolidity/interface/CompilerStack.h>
using namespace std;
using namespace dev;
using namespace dev::solidity;
-Json::Value Natspec::documentation(
- ContractDefinition const& _contractDef,
- DocumentationType _type
-)
-{
- switch(_type)
- {
- case DocumentationType::NatspecUser:
- return userDocumentation(_contractDef);
- case DocumentationType::NatspecDev:
- return devDocumentation(_contractDef);
- }
-
- BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown documentation type"));
-}
-
Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef)
{
Json::Value doc;
diff --git a/libsolidity/interface/Natspec.h b/libsolidity/interface/Natspec.h
index bec9acd2..9ac3efea 100644
--- a/libsolidity/interface/Natspec.h
+++ b/libsolidity/interface/Natspec.h
@@ -39,7 +39,6 @@ class ContractDefinition;
class Type;
using TypePointer = std::shared_ptr<Type const>;
struct DocTag;
-enum class DocumentationType: uint8_t;
enum class DocTagType: uint8_t
{
@@ -61,15 +60,6 @@ enum class CommentOwner
class Natspec
{
public:
- /// Get the given type of documentation
- /// @param _contractDef The contract definition
- /// @param _type The type of the documentation. Can be one of the
- /// types provided by @c DocumentationType
- /// @return A JSON representation of provided type
- static Json::Value documentation(
- ContractDefinition const& _contractDef,
- DocumentationType _type
- );
/// Get the User documentation of the contract
/// @param _contractDef The contract definition
/// @return A JSON representation of the contract's user documentation