mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #555 from Denton-L/single-line-functions
Added a Clause in Style Guide about Single Line Function Declarations
This commit is contained in:
commit
00c89cdb49
@ -155,7 +155,7 @@ Whitespace in Expressions
|
|||||||
|
|
||||||
Avoid extraneous whitespace in the following situations:
|
Avoid extraneous whitespace in the following situations:
|
||||||
|
|
||||||
Immediately inside parenthesis, brackets or braces.
|
Immediately inside parenthesis, brackets or braces, with the exception of single-line function declarations.
|
||||||
|
|
||||||
Yes::
|
Yes::
|
||||||
|
|
||||||
@ -165,6 +165,10 @@ No::
|
|||||||
|
|
||||||
spam( ham[ 1 ], Coin( { name: "ham" } ) );
|
spam( ham[ 1 ], Coin( { name: "ham" } ) );
|
||||||
|
|
||||||
|
Exception::
|
||||||
|
|
||||||
|
function singleLine() { spam(); }
|
||||||
|
|
||||||
Immediately before a comma, semicolon:
|
Immediately before a comma, semicolon:
|
||||||
|
|
||||||
Yes::
|
Yes::
|
||||||
@ -482,6 +486,11 @@ No::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
When declaring short functions with a single statement, it is permissible to do it on a single line.
|
||||||
|
|
||||||
|
Permissible::
|
||||||
|
|
||||||
|
function shortFunction() { doSomething(); }
|
||||||
|
|
||||||
These guidelines for function declarations are intended to improve readability.
|
These guidelines for function declarations are intended to improve readability.
|
||||||
Authors should use their best judgement as this guide does not try to cover all
|
Authors should use their best judgement as this guide does not try to cover all
|
||||||
|
Loading…
Reference in New Issue
Block a user