solidity/test/libsolidity/semanticTests/tryCatch/trivial.sol

19 lines
384 B
Solidity
Raw Normal View History

2019-09-03 16:31:17 +00:00
contract C {
function g(bool x) public pure {
require(x);
}
function f(bool x) public returns (uint) {
// Set the gas to make this work on pre-byzantium VMs
try this.g{gas: 8000}(x) {
2019-09-03 16:31:17 +00:00
return 1;
} catch {
return 2;
}
}
}
// ====
// compileViaYul: also
2019-09-03 16:31:17 +00:00
// ----
// f(bool): true -> 1
// f(bool): false -> 2