diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-07-15 22:23:10 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-07-16 19:57:56 +0800 |
commit | 223b9b101a6b89f57f01e78863d78950e1636e46 (patch) | |
tree | d5ffa503e530bcff6bef9788339c1cf1f2794512 | |
parent | bfb2def2c9cb2b970e99b6c0af23d8b3f7f5969c (diff) | |
download | dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.tar dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.tar.gz dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.tar.bz2 dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.tar.lz dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.tar.xz dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.tar.zst dexon-solidity-223b9b101a6b89f57f01e78863d78950e1636e46.zip |
removed unnecessary function
-rw-r--r-- | CompilerStack.cpp | 18 | ||||
-rw-r--r-- | CompilerStack.h | 3 | ||||
-rw-r--r-- | InterfaceHandler.h | 2 |
3 files changed, 8 insertions, 15 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp index 6013c00d..f056bb9b 100644 --- a/CompilerStack.cpp +++ b/CompilerStack.cpp @@ -116,6 +116,7 @@ void CompilerStack::parse() resolver.resolveNamesAndTypes(*contract); m_contracts[contract->getName()].contract = contract; } + InterfaceHandler interfaceHandler; for (Source const* source: m_sourceOrder) for (ASTPointer<ASTNode> const& node: source->ast->getNodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) @@ -123,20 +124,13 @@ void CompilerStack::parse() m_globalContext->setCurrentContract(*contract); resolver.updateDeclaration(*m_globalContext->getCurrentThis()); resolver.checkTypeRequirements(*contract); + contract->setDevDocumentation(interfaceHandler.devDocumentation(*contract)); + contract->setUserDocumentation(interfaceHandler.userDocumentation(*contract)); m_contracts[contract->getName()].contract = contract; - parseNatspecDocumentation(*contract); } m_parseSuccessful = true; } -void CompilerStack::parseNatspecDocumentation(ContractDefinition const& _contract) -{ - InterfaceHandler interfaceHandler; - string devDoc =_contract.devDocumentation(); - devDoc = interfaceHandler.devDocumentation(_contract); - //interfaceHandler.generateUserDocumentation(_contract); -} - void CompilerStack::parse(string const& _sourceCode) { setSource(_sourceCode); @@ -240,6 +234,8 @@ string const& CompilerStack::getMetadata(string const& _contractName, Documentat Contract const& contract = getContract(_contractName); std::unique_ptr<string const>* doc; + + // checks wheather we already have the documentation switch (_type) { case DocumentationType::NatspecUser: @@ -257,10 +253,10 @@ string const& CompilerStack::getMetadata(string const& _contractName, Documentat default: BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type.")); } - auto resPtr = ((*doc) ? *(*doc) : contract.interfaceHandler->getDocumentation(*contract.contract, _type)); + // caches the result if (!*doc) - *doc = (unique_ptr<string>(new string(contract.interfaceHandler->getDocumentation(*contract.contract, _type)))); + doc->reset(new string(contract.interfaceHandler->getDocumentation(*contract.contract, _type))); return *(*doc); } diff --git a/CompilerStack.h b/CompilerStack.h index dd049885..a7c6ea3b 100644 --- a/CompilerStack.h +++ b/CompilerStack.h @@ -148,9 +148,6 @@ public: /// start line, start column, end line, end column std::tuple<int, int, int, int> positionFromSourceLocation(SourceLocation const& _sourceLocation) const; - /// Parses Natspec documentations. Throws exceptions in case of wrong documented contract - void parseNatspecDocumentation(dev::solidity::ContractDefinition const& _contract); - private: /** * Information pertaining to one source unit, filled gradually during parsing and compilation. diff --git a/InterfaceHandler.h b/InterfaceHandler.h index 49e92fcb..7784dbd7 100644 --- a/InterfaceHandler.h +++ b/InterfaceHandler.h @@ -82,7 +82,7 @@ public: /// Genereates the Developer's documentation of the contract /// @param _contractDef The contract definition /// @return A string with the json representation - /// of the contract's developer documentation + /// of the contract's developer documentation std::string devDocumentation(ContractDefinition const& _contractDef); private: |