Merge pull request #10669 from ethereum/testRecursionModifiers

Test for recursion with modifiers.
This commit is contained in:
chriseth 2020-12-21 12:06:26 +01:00 committed by GitHub
commit a9a62e86df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,17 @@
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
// ----
// called() -> 0x00
// f(uint256): 5 -> 0x0100000000
// called() -> 6