mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Deprecate the throw statement
This commit is contained in:
parent
931794001e
commit
21e97da294
@ -20,6 +20,7 @@ Breaking Changes:
|
||||
* General: Disallow raw ``callcode`` (was already deprecated in 0.4.12). It is still possible to use it via inline assembly.
|
||||
* General: Disallow ``var`` keyword.
|
||||
* General: Disallow ``sha3`` and ``suicide`` aliases.
|
||||
* General: Disallow the ``throw`` statement. This was already the case in the experimental 0.5.0 mode.
|
||||
* General: Disallow the ``years`` unit denomination (was already deprecated in 0.4.24)
|
||||
* General: Introduce ``emit`` as a keyword instead of parsing it as identifier.
|
||||
* General: New keywords: ``calldata``
|
||||
|
@ -175,18 +175,10 @@ bool SyntaxChecker::visit(Break const& _breakStatement)
|
||||
|
||||
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(
|
||||
_throwStatement.location(),
|
||||
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
|
||||
);
|
||||
m_errorReporter.syntaxError(
|
||||
_throwStatement.location(),
|
||||
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
contract C {
|
||||
struct S { bool f; }
|
||||
S s;
|
||||
function f() internal pure returns (S storage) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (108-113): "throw" is deprecated in favour of "revert()", "require()" and "assert()".
|
@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (52-57): "throw" is deprecated in favour of "revert()", "require()" and "assert()".
|
||||
// SyntaxError: (52-57): "throw" is deprecated in favour of "revert()", "require()" and "assert()".
|
||||
|
@ -1,8 +0,0 @@
|
||||
pragma experimental "v0.5.0";
|
||||
contract C {
|
||||
function f() pure public {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (82-87): "throw" is deprecated in favour of "revert()", "require()" and "assert()".
|
Loading…
Reference in New Issue
Block a user