mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3605 from ethereum/deprecate-throw
Turn throw into a syntax error for 0.5.0
This commit is contained in:
commit
415ac2ae87
@ -6,6 +6,7 @@ Features:
|
|||||||
* Type Checker: Disallow uninitialized storage pointers as experimental 0.5.0 feature.
|
* Type Checker: Disallow uninitialized storage pointers as experimental 0.5.0 feature.
|
||||||
* Support and recommend using ``emit EventName();`` to call events explicitly.
|
* Support and recommend using ``emit EventName();`` to call events explicitly.
|
||||||
* Syntax Analyser: Do not warn about experimental features if they do not concern code generation.
|
* Syntax Analyser: Do not warn about experimental features if they do not concern code generation.
|
||||||
|
* Syntax Checker: Mark ``throw`` as an error as experimental 0.5.0 feature.
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Assembly: Raise error on oversized number literals in assembly.
|
* Assembly: Raise error on oversized number literals in assembly.
|
||||||
|
@ -174,6 +174,14 @@ bool SyntaxChecker::visit(Break const& _breakStatement)
|
|||||||
|
|
||||||
bool SyntaxChecker::visit(Throw const& _throwStatement)
|
bool SyntaxChecker::visit(Throw const& _throwStatement)
|
||||||
{
|
{
|
||||||
|
bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050);
|
||||||
|
|
||||||
|
if (v050)
|
||||||
|
m_errorReporter.syntaxError(
|
||||||
|
_throwStatement.location(),
|
||||||
|
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
|
||||||
|
);
|
||||||
|
else
|
||||||
m_errorReporter.warning(
|
m_errorReporter.warning(
|
||||||
_throwStatement.location(),
|
_throwStatement.location(),
|
||||||
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
|
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
|
||||||
|
@ -6332,7 +6332,16 @@ BOOST_AUTO_TEST_CASE(warn_about_throw)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_WARNING(text, "\"throw\" is deprecated");
|
CHECK_WARNING(text, "\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"");
|
||||||
|
text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() pure public {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, SyntaxError, "\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(bare_revert)
|
BOOST_AUTO_TEST_CASE(bare_revert)
|
||||||
|
Loading…
Reference in New Issue
Block a user