Stack compiler now correctly returns a string and not a pointer

This commit is contained in:
Lefteris Karapetsas 2014-12-05 12:41:32 +01:00
parent 27ef18865d
commit c8f96589c5
2 changed files with 5 additions and 5 deletions

View File

@ -84,7 +84,7 @@ void CompilerStack::streamAssembly(ostream& _outStream)
m_compiler->streamAssembly(_outStream); m_compiler->streamAssembly(_outStream);
} }
std::string const* CompilerStack::getJsonDocumentation(enum DocumentationType _type) std::string const& CompilerStack::getJsonDocumentation(enum DocumentationType _type)
{ {
if (!m_parseSuccessful) if (!m_parseSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
@ -99,13 +99,13 @@ std::string const* CompilerStack::getJsonDocumentation(enum DocumentationType _t
{ {
case NATSPEC_USER: case NATSPEC_USER:
createDocIfNotThere(m_userDocumentation); createDocIfNotThere(m_userDocumentation);
return m_userDocumentation.get(); return *m_userDocumentation;
case NATSPEC_DEV: case NATSPEC_DEV:
createDocIfNotThere(m_devDocumentation); createDocIfNotThere(m_devDocumentation);
return m_devDocumentation.get(); return *m_devDocumentation;
case ABI_INTERFACE: case ABI_INTERFACE:
createDocIfNotThere(m_interface); createDocIfNotThere(m_interface);
return m_interface.get(); return *m_interface;
} }
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type.")); BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type."));

View File

@ -74,7 +74,7 @@ public:
/// Prerequisite: Successful call to parse or compile. /// Prerequisite: Successful call to parse or compile.
/// @param type The type of the documentation to get. /// @param type The type of the documentation to get.
/// Can be one of 3 types defined at @c documentation_type /// Can be one of 3 types defined at @c documentation_type
std::string const* getJsonDocumentation(enum DocumentationType type); std::string const& getJsonDocumentation(enum DocumentationType type);
/// Returns the previously used scanner, useful for counting lines during error reporting. /// Returns the previously used scanner, useful for counting lines during error reporting.
Scanner const& getScanner() const { return *m_scanner; } Scanner const& getScanner() const { return *m_scanner; }