solidity/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol

19 lines
332 B
Solidity
Raw Normal View History

2020-12-21 10:39:59 +00:00
contract C {
uint public called;
modifier mod1 {
called++;
_;
}
function f(uint x) public mod1 returns (uint256 r) {
return x == 0 ? 2 : f(x - 1)**2;
}
}
// ====
// compileViaYul: also
2021-04-23 15:59:01 +00:00
// compileToEwasm: also
2020-12-21 10:39:59 +00:00
// ----
// called() -> 0x00
// f(uint256): 5 -> 0x0100000000
// called() -> 6