diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp index 51f60f790..a04c9314e 100644 --- a/libsolidity/analysis/DocStringAnalyser.cpp +++ b/libsolidity/analysis/DocStringAnalyser.cpp @@ -34,10 +34,9 @@ using namespace solidity::frontend; bool DocStringAnalyser::analyseDocStrings(SourceUnit const& _sourceUnit) { - m_errorOccured = false; + auto errorWatcher = m_errorReporter.errorWatcher(); _sourceUnit.accept(*this); - - return !m_errorOccured; + return errorWatcher.ok(); } bool DocStringAnalyser::visit(ContractDefinition const& _contract) @@ -152,8 +151,7 @@ void DocStringAnalyser::parseDocStrings( DocStringParser parser; if (_node.documentation() && !_node.documentation()->text()->empty()) { - if (!parser.parse(*_node.documentation()->text(), m_errorReporter)) - m_errorOccured = true; + parser.parse(*_node.documentation()->text(), m_errorReporter); _annotation.docTags = parser.tags(); } @@ -210,6 +208,5 @@ void DocStringAnalyser::parseDocStrings( void DocStringAnalyser::appendError(SourceLocation const& _location, string const& _description) { - m_errorOccured = true; m_errorReporter.docstringParsingError(7816_error, _location, _description); } diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h index 09fa07b40..cddfc2f1d 100644 --- a/libsolidity/analysis/DocStringAnalyser.h +++ b/libsolidity/analysis/DocStringAnalyser.h @@ -83,7 +83,6 @@ private: void appendError(langutil::SourceLocation const& _location, std::string const& _description); - bool m_errorOccured = false; langutil::ErrorReporter& m_errorReporter; }; diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index b8238554f..3ce67a430 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -77,10 +77,9 @@ string::const_iterator skipWhitespace( } -bool DocStringParser::parse(string const& _docString, ErrorReporter& _errorReporter) +void DocStringParser::parse(string const& _docString, ErrorReporter& _errorReporter) { m_errorReporter = &_errorReporter; - m_errorsOccurred = false; m_lastTag = nullptr; auto currPos = _docString.begin(); @@ -119,7 +118,6 @@ bool DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor currPos = nlPos + 1; } } - return !m_errorsOccurred; } DocStringParser::iter DocStringParser::parseDocTagLine(iter _pos, iter _end, bool _appending) @@ -194,6 +192,5 @@ void DocStringParser::newTag(string const& _tagName) void DocStringParser::appendError(string const& _description) { - m_errorsOccurred = true; m_errorReporter->docstringParsingError(9440_error, _description); } diff --git a/libsolidity/parsing/DocStringParser.h b/libsolidity/parsing/DocStringParser.h index dc9c5194c..b4c9186a7 100644 --- a/libsolidity/parsing/DocStringParser.h +++ b/libsolidity/parsing/DocStringParser.h @@ -37,8 +37,7 @@ class DocStringParser { public: /// Parse the given @a _docString and stores the parsed components internally. - /// @returns false on error and appends the error to @a _errors. - bool parse(std::string const& _docString, langutil::ErrorReporter& _errorReporter); + void parse(std::string const& _docString, langutil::ErrorReporter& _errorReporter); std::multimap const& tags() const { return m_docTags; } @@ -65,7 +64,6 @@ private: std::multimap m_docTags; DocTag* m_lastTag = nullptr; langutil::ErrorReporter* m_errorReporter = nullptr; - bool m_errorsOccurred = false; }; }