2

My modifiers are throwing internal compilation errors: Internal compiler error: Identifier type not expected in expression context.

modifier critical {
    if (mutex) throw;
    mutex = true;
    _;
    mutex = false;
}

function createPlayer() {
    critical; 
    var player = players[msg.sender];
    if (player.ready) { throw; }
    player.ethaddress = msg.sender;
    player.creationdate = block.timestamp; 
    player.balance += msg.value;
}

2 Answers 2

1
function createPlayer() critical {
// Not
function createPlayer() {
    critical; 
1

Modifiers are specified after the function, like:

function createPlayer() critical {
    ...
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.