mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1005 from ethereum/modifierbody
Require ";" after "_"
This commit is contained in:
@@ -148,10 +148,10 @@ restrictions highly readable.
|
||||
{
|
||||
if (msg.sender != _account)
|
||||
throw;
|
||||
// Do not forget the "_"! It will
|
||||
// Do not forget the "_;"! It will
|
||||
// be replaced by the actual function
|
||||
// body when the modifier is invoked.
|
||||
_
|
||||
_;
|
||||
}
|
||||
|
||||
/// Make `_newOwner` the new owner of this
|
||||
@@ -164,7 +164,7 @@ restrictions highly readable.
|
||||
|
||||
modifier onlyAfter(uint _time) {
|
||||
if (now < _time) throw;
|
||||
_
|
||||
_;
|
||||
}
|
||||
|
||||
/// Erase ownership information.
|
||||
@@ -187,7 +187,7 @@ restrictions highly readable.
|
||||
modifier costs(uint _amount) {
|
||||
if (msg.value < _amount)
|
||||
throw;
|
||||
_
|
||||
_;
|
||||
if (msg.value > _amount)
|
||||
msg.sender.send(msg.value - _amount);
|
||||
}
|
||||
@@ -286,7 +286,7 @@ function finishes.
|
||||
|
||||
modifier atStage(Stages _stage) {
|
||||
if (stage != _stage) throw;
|
||||
_
|
||||
_;
|
||||
}
|
||||
|
||||
function nextStage() internal {
|
||||
@@ -304,7 +304,7 @@ function finishes.
|
||||
now >= creationTime + 12 days)
|
||||
nextStage();
|
||||
// The other stages transition by transaction
|
||||
_
|
||||
_;
|
||||
}
|
||||
|
||||
// Order of the modifiers matters here!
|
||||
@@ -328,7 +328,7 @@ function finishes.
|
||||
// automatically.
|
||||
modifier transitionNext()
|
||||
{
|
||||
_
|
||||
_;
|
||||
nextStage();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -321,7 +321,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
||||
modifier onlyOwner {
|
||||
if (msg.sender != owner)
|
||||
throw;
|
||||
_
|
||||
_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
||||
// Modifiers can receive arguments:
|
||||
modifier costs(uint price) {
|
||||
if (msg.value >= price) {
|
||||
_
|
||||
_;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
||||
modifier noReentrancy() {
|
||||
if (locked) throw;
|
||||
locked = true;
|
||||
_
|
||||
_;
|
||||
locked = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -403,8 +403,8 @@ high or low invalid bids.
|
||||
/// functions. `onlyBefore` is applied to `bid` below:
|
||||
/// The new function body is the modifier's body where
|
||||
/// `_` is replaced by the old function body.
|
||||
modifier onlyBefore(uint _time) { if (now >= _time) throw; _ }
|
||||
modifier onlyAfter(uint _time) { if (now <= _time) throw; _ }
|
||||
modifier onlyBefore(uint _time) { if (now >= _time) throw; _; }
|
||||
modifier onlyAfter(uint _time) { if (now <= _time) throw; _; }
|
||||
|
||||
function BlindAuction(
|
||||
uint _biddingTime,
|
||||
|
||||
Reference in New Issue
Block a user