mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8915 from a3d4/partfix-5819-remove-erroroccurred-flag
Remove a dedicated error flag from DeclarationTypeChecker and other classes
This commit is contained in:
commit
b2122d479f
@ -134,6 +134,12 @@ public:
|
||||
return m_errorCount > 0;
|
||||
}
|
||||
|
||||
/// @returns the number of errors (ignores warnings).
|
||||
unsigned errorCount() const
|
||||
{
|
||||
return m_errorCount;
|
||||
}
|
||||
|
||||
// @returns true if the maximum error count has been reached.
|
||||
bool hasExcessiveErrors() const;
|
||||
|
||||
|
@ -361,24 +361,22 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable)
|
||||
|
||||
void DeclarationTypeChecker::typeError(SourceLocation const& _location, string const& _description)
|
||||
{
|
||||
m_errorOccurred = true;
|
||||
m_errorReporter.typeError(2311_error, _location, _description);
|
||||
}
|
||||
|
||||
void DeclarationTypeChecker::fatalTypeError(SourceLocation const& _location, string const& _description)
|
||||
{
|
||||
m_errorOccurred = true;
|
||||
m_errorReporter.fatalTypeError(5651_error, _location, _description);
|
||||
}
|
||||
|
||||
void DeclarationTypeChecker::fatalDeclarationError(SourceLocation const& _location, string const& _description)
|
||||
{
|
||||
m_errorOccurred = true;
|
||||
m_errorReporter.fatalDeclarationError(2046_error, _location, _description);
|
||||
}
|
||||
|
||||
bool DeclarationTypeChecker::check(ASTNode const& _node)
|
||||
{
|
||||
unsigned errorCount = m_errorReporter.errorCount();
|
||||
_node.accept(*this);
|
||||
return !m_errorOccurred;
|
||||
return m_errorReporter.errorCount() == errorCount;
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ private:
|
||||
void fatalDeclarationError(langutil::SourceLocation const& _location, std::string const& _description);
|
||||
|
||||
langutil::ErrorReporter& m_errorReporter;
|
||||
bool m_errorOccurred = false;
|
||||
langutil::EVMVersion m_evmVersion;
|
||||
bool m_insideFunctionType = false;
|
||||
bool m_recursiveStructSeen = false;
|
||||
|
@ -3,5 +3,3 @@ contract test {
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (31-55): The "constant" keyword can only be used for state variables.
|
||||
// TypeError: (31-55): Constants of non-value type not yet implemented.
|
||||
// TypeError: (31-55): Uninitialized "constant" variable.
|
||||
|
@ -3,5 +3,3 @@ contract Foo {
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (30-55): The "constant" keyword can only be used for state variables.
|
||||
// TypeError: (30-55): Constants of non-value type not yet implemented.
|
||||
// TypeError: (30-55): Uninitialized "constant" variable.
|
||||
|
Loading…
Reference in New Issue
Block a user