diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-19 04:05:34 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-19 04:05:34 +0800 |
commit | 5bb4bfb08b7157ef79aaa673881638c809adf6a7 (patch) | |
tree | d67ac448801508e568b166f7b531fc8c157e1a85 /libsolidity | |
parent | 01fbc636239f78134b37f9dedeacf40455ee2e0c (diff) | |
download | dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.tar dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.tar.gz dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.tar.bz2 dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.tar.lz dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.tar.xz dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.tar.zst dexon-solidity-5bb4bfb08b7157ef79aaa673881638c809adf6a7.zip |
Remove unneccesary interface from Natspec
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 10 | ||||
-rw-r--r-- | libsolidity/interface/Natspec.cpp | 17 | ||||
-rw-r--r-- | libsolidity/interface/Natspec.h | 10 |
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 |