diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-06-15 21:21:23 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-07-16 19:57:55 +0800 |
commit | 43398adc99b1e05c80dd31d44d742b4851c8771d (patch) | |
tree | 00e7e4434bb7b9b66a63b17b4834a780b55141ce /InterfaceHandler.cpp | |
parent | 54fa8ed7a69cdb9e4e83b3039d4e8a8806f11976 (diff) | |
download | dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.tar dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.tar.gz dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.tar.bz2 dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.tar.lz dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.tar.xz dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.tar.zst dexon-solidity-43398adc99b1e05c80dd31d44d742b4851c8771d.zip |
contract documentation is now parsing during compilation and not by request.
Diffstat (limited to 'InterfaceHandler.cpp')
-rw-r--r-- | InterfaceHandler.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp index 23b7ff82..36940d27 100644 --- a/InterfaceHandler.cpp +++ b/InterfaceHandler.cpp @@ -24,9 +24,9 @@ unique_ptr<string> InterfaceHandler::getDocumentation( switch(_type) { case DocumentationType::NatspecUser: - return getUserDocumentation(_contractDef); + return userDocumentation(_contractDef); case DocumentationType::NatspecDev: - return getDevDocumentation(_contractDef); + return devDocumentation(_contractDef); case DocumentationType::ABIInterface: return getABIInterface(_contractDef); case DocumentationType::ABISolidityInterface: @@ -143,7 +143,7 @@ unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition return unique_ptr<string>(new string(ret + "}")); } -unique_ptr<string> InterfaceHandler::getUserDocumentation(ContractDefinition const& _contractDef) +void InterfaceHandler::generateUserDocumentation(ContractDefinition& _contractDef) { Json::Value doc; Json::Value methods(Json::objectValue); @@ -165,10 +165,20 @@ unique_ptr<string> InterfaceHandler::getUserDocumentation(ContractDefinition con } doc["methods"] = methods; - return unique_ptr<string>(new string(Json::FastWriter().write(doc))); + _contractDef.setUserDocumentation(string(Json::FastWriter().write(doc))); } -unique_ptr<string> InterfaceHandler::getDevDocumentation(ContractDefinition const& _contractDef) +unique_ptr<string> InterfaceHandler::userDocumentation(ContractDefinition const& _contractDef) +{ + return _contractDef.userDocumentation(); +} + +unique_ptr<string> InterfaceHandler::devDocumentation(ContractDefinition const& _contractDef) +{ + return _contractDef.devDocumentation(); +} + +void InterfaceHandler::generateDevDocumentation(ContractDefinition& _contractDef) { // LTODO: Somewhere in this function warnings for mismatch of param names // should be thrown @@ -212,7 +222,7 @@ unique_ptr<string> InterfaceHandler::getDevDocumentation(ContractDefinition cons // 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") + errinfo_comment("documented parameter \"" + pair.first + "\" not found in the parameter list of the function.") ); params[pair.first] = pair.second; } @@ -229,7 +239,7 @@ unique_ptr<string> InterfaceHandler::getDevDocumentation(ContractDefinition cons } doc["methods"] = methods; - return unique_ptr<string>(new string(Json::FastWriter().write(doc))); + _contractDef.setDevDocumentation(string(Json::FastWriter().write(doc))); } /* -- private -- */ |