Deprecate throw.

This commit is contained in:
chriseth
2017-07-05 21:15:00 +02:00
parent 4bde6fa961
commit 0400e61e28
4 changed files with 27 additions and 1 deletions
+10
View File
@@ -135,6 +135,16 @@ bool SyntaxChecker::visit(Break const& _breakStatement)
return true;
}
bool SyntaxChecker::visit(Throw const& _throwStatement)
{
m_errorReporter.warning(
_throwStatement.location(),
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
);
return true;
}
bool SyntaxChecker::visit(UnaryOperation const& _operation)
{
if (_operation.getOperator() == Token::Add)
+3
View File
@@ -33,6 +33,7 @@ namespace solidity
* - whether continue/break is in a for/while loop.
* - whether a modifier contains at least one '_'
* - issues deprecation warnings for unary '+'
* - issues deprecation warning for throw
*/
class SyntaxChecker: private ASTConstVisitor
{
@@ -59,6 +60,8 @@ private:
virtual bool visit(Continue const& _continueStatement) override;
virtual bool visit(Break const& _breakStatement) override;
virtual bool visit(Throw const& _throwStatement) override;
virtual bool visit(UnaryOperation const& _operation) override;
virtual bool visit(PlaceholderStatement const& _placeholderStatement) override;