mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove dedicated error flags from DocStringParser and DocStringAnalyser
This commit is contained in:
parent
6dbf23d52a
commit
6bb177ce77
@ -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);
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ private:
|
||||
|
||||
void appendError(langutil::SourceLocation const& _location, std::string const& _description);
|
||||
|
||||
bool m_errorOccured = false;
|
||||
langutil::ErrorReporter& m_errorReporter;
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<std::string, DocTag> const& tags() const { return m_docTags; }
|
||||
|
||||
@ -65,7 +64,6 @@ private:
|
||||
std::multimap<std::string, DocTag> m_docTags;
|
||||
DocTag* m_lastTag = nullptr;
|
||||
langutil::ErrorReporter* m_errorReporter = nullptr;
|
||||
bool m_errorsOccurred = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user