2019-03-19 16:12:21 +00:00
|
|
|
contract C {
|
|
|
|
function f() public returns (uint) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
function f(uint a) public returns (uint) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
function f(uint a, uint b) public returns (uint) {
|
|
|
|
return a+b;
|
|
|
|
}
|
|
|
|
function f(uint a, uint b, uint c) public returns (uint) {
|
|
|
|
return a+b+c;
|
|
|
|
}
|
|
|
|
function call(uint num) public returns (uint256) {
|
|
|
|
if (num == 0)
|
|
|
|
return f();
|
|
|
|
if (num == 1)
|
|
|
|
return f({a: 1});
|
|
|
|
if (num == 2)
|
|
|
|
return f({b: 1, a: 2});
|
|
|
|
if (num == 3)
|
|
|
|
return f({c: 1, a: 2, b: 3});
|
2020-11-09 13:09:34 +00:00
|
|
|
if (num == 4)
|
|
|
|
return f({b: 5, c: 1, a: 2});
|
2019-03-19 16:12:21 +00:00
|
|
|
|
|
|
|
return 500;
|
|
|
|
}
|
|
|
|
}
|
2019-05-23 14:38:11 +00:00
|
|
|
// ====
|
2020-11-21 13:54:16 +00:00
|
|
|
// compileToEwasm: also
|
2021-03-12 23:02:36 +00:00
|
|
|
// compileViaYul: also
|
2019-03-19 16:12:21 +00:00
|
|
|
// ----
|
|
|
|
// call(uint256): 0 -> 0
|
|
|
|
// call(uint256): 1 -> 1
|
|
|
|
// call(uint256): 2 -> 3
|
|
|
|
// call(uint256): 3 -> 6
|
2020-11-09 13:09:34 +00:00
|
|
|
// call(uint256): 4 -> 8
|
|
|
|
// call(uint256): 5 -> 500
|