Updates to control structures (2).

Co-Authored-By: Bhargava Shastry <bhargava.shastry@ethereum.org>
This commit is contained in:
chriseth
2019-12-12 17:01:57 +01:00
co-authored by Bhargava Shastry
parent c8a59d9fd3
commit 670b719773
2 changed files with 66 additions and 18 deletions
@@ -0,0 +1,16 @@
contract C {
function g(bool x) public pure {
assert(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) {
return 1;
} catch {
return 2;
}
}
}
// ----
// f(bool): true -> 1
// f(bool): false -> 2