Split fallback function and introduce "fallback()" and "receive()" syntax.

This commit is contained in:
Daniel Kirchner
2019-11-04 17:17:58 +01:00
parent 3d625cc239
commit 3321fc56ea
137 changed files with 1340 additions and 386 deletions
+22 -5
View File
@@ -273,6 +273,7 @@ Ordering helps readers identify which functions they can call and to find the co
Functions should be grouped according to their visibility and ordered:
- constructor
- receive function (if exists)
- fallback function (if exists)
- external
- public
@@ -290,7 +291,11 @@ Yes::
// ...
}
function() external {
receive() external payable {
// ...
}
fallback() external {
// ...
}
@@ -322,7 +327,10 @@ No::
// External functions
// ...
function() external {
fallback() external {
// ...
}
receive() external payable {
// ...
}
@@ -384,20 +392,29 @@ No::
y = 2;
long_variable = 3;
Don't include a whitespace in the fallback function:
Don't include a whitespace in the receive and fallback functions:
Yes::
function() external {
receive() external payable {
...
}
fallback() external {
...
}
No::
function () external {
receive () external payable {
...
}
fallback () external {
...
}
Control Structures
==================