debugging Solidity中的语法错误:需要'('但得到')' -如何修复?

c8ib6hqw  于 2023-03-19  发布在  其他
关注(0)|答案(1)|浏览(141)

'嗨,我把代码升级到了solidity 0.6.0;我有这样的错误:应为“(”,但得到的实性为“)”。
我想不通!
如果有人能帮我理解为什么会发生这种事。
函数如下:

function _delegate(address implementation) internal {
    assembly {
    // Copy msg.data. We take full control of memory in this inline assembly
    // block because it will not return to Solidity code. We overwrite the
    // Solidity scratch pad at memory position 0.
        calldatacopy(0, 0, calldatasize)

    // Call the implementation.
    // out and outsize are 0 because we don't know the size yet.
        let result := delegatecall(gas(), implementation, 0, calldatasize, 0, 0)

    // Copy the returned data.
        returndatacopy(0, 0, returndatasize)  // error

        switch result
        // delegatecall returns 0 on error.
        case 0 { revert(0, returndatasize) } 
        default { return(0, returndatasize) }
    }
}

如果有人能弄明白的话!我一定要把完整的代码发出去吗?“

l2osamch

l2osamch1#

Solidity 0.6中的Assembly要求所有函数调用都带括号,即使它们不接受任何参数。
例如,calldatasize()代替calldatasizereturndatasize()代替returndatasize

相关问题