File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11### 0.4.13 (unreleased)
22
33Features:
4+ * Syntax Checker: Deprecated "throw" in favour of require(), assert() and revert().
45 * Type Checker: Warn if a local storage reference variable does not explicitly use the keyword `` storage `` .
56
67Bugfixes:
7- * Compiler Interface: Only output AST if analysis was successful.
88 * Code Generator: Correctly unregister modifier variables.
9+ * Compiler Interface: Only output AST if analysis was successful.
910 * Error Output: Do not omit the error type.
1011
1112### 0.4.12 (2017-07-03)
Original file line number Diff line number Diff line change @@ -135,6 +135,16 @@ bool SyntaxChecker::visit(Break const& _breakStatement)
135135 return true ;
136136}
137137
138+ bool SyntaxChecker::visit (Throw const & _throwStatement)
139+ {
140+ m_errorReporter.warning (
141+ _throwStatement.location (),
142+ " \" throw\" is deprecated in favour of \" revert()\" , \" require()\" and \" assert()\" ."
143+ );
144+
145+ return true ;
146+ }
147+
138148bool SyntaxChecker::visit (UnaryOperation const & _operation)
139149{
140150 if (_operation.getOperator () == Token::Add)
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ namespace solidity
3333 * - whether continue/break is in a for/while loop.
3434 * - whether a modifier contains at least one '_'
3535 * - issues deprecation warnings for unary '+'
36+ * - issues deprecation warning for throw
3637 */
3738class SyntaxChecker : private ASTConstVisitor
3839{
@@ -59,6 +60,8 @@ class SyntaxChecker: private ASTConstVisitor
5960 virtual bool visit (Continue const & _continueStatement) override ;
6061 virtual bool visit (Break const & _breakStatement) override ;
6162
63+ virtual bool visit (Throw const & _throwStatement) override ;
64+
6265 virtual bool visit (UnaryOperation const & _operation) override ;
6366
6467 virtual bool visit (PlaceholderStatement const & _placeholderStatement) override ;
Original file line number Diff line number Diff line change @@ -5860,6 +5860,18 @@ BOOST_AUTO_TEST_CASE(using_interface_complex)
58605860 success (text);
58615861}
58625862
5863+ BOOST_AUTO_TEST_CASE (warn_about_throw)
5864+ {
5865+ char const * text = R"(
5866+ contract C {
5867+ function f() {
5868+ throw;
5869+ }
5870+ }
5871+ )" ;
5872+ CHECK_WARNING (text, " \" throw\" is deprecated" );
5873+ }
5874+
58635875BOOST_AUTO_TEST_CASE (bare_revert)
58645876{
58655877 char const * text = R"(
You can’t perform that action at this time.
0 commit comments