Implement function modifiers.

This commit is contained in:
chriseth
2020-12-17 17:00:51 +01:00
parent 9328503265
commit ccaa81fbe7
22 changed files with 220 additions and 8 deletions
@@ -34,5 +34,7 @@ contract C is B {
return (x, y);
}
}
// ====
// compileViaYul: also
// ----
// test() -> 5, 10
@@ -28,6 +28,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> true
// g() -> FAILURE
@@ -14,6 +14,8 @@ contract C {
x = t;
}
}
// ====
// compileViaYul: also
// ----
// x() -> 0
// f() ->
@@ -14,6 +14,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// x() -> 0
// f() ->
@@ -8,6 +8,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// getOne() -> 0
// getOne(), 1 wei -> 1
@@ -13,5 +13,7 @@ contract C is A {
}
}
// ====
// compileViaYul: also
// ----
// f() -> false
@@ -24,5 +24,7 @@ contract Test {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x202
@@ -30,5 +30,7 @@ contract Test {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x202
@@ -15,5 +15,7 @@ contract C is A {
}
}
// ====
// compileViaYul: also
// ----
// f() -> false
@@ -0,0 +1,13 @@
contract C {
modifier m(bool condition) {
if (condition) _;
}
function f(uint x) public m(x >= 10) returns (uint[5] memory r) {
r[2] = 3;
}
}
// ----
// f(uint256): 9 -> 0x00, 0x00, 0x00, 0x00, 0x00
// f(uint256): 10 -> 0x00, 0x00, 3, 0x00, 0x00
@@ -10,6 +10,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// x() -> 0
// f() -> 2
@@ -14,6 +14,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// x() -> 0
// f() ->
@@ -13,6 +13,8 @@ contract C {
return address(this).balance;
}
}
// ====
// compileViaYul: also
// ----
// f(), 27 wei -> FAILURE
// balance() -> 0
@@ -16,6 +16,8 @@ contract C {
x += 3;
}
}
// ====
// compileViaYul: also
// ----
// f1() ->
// x() -> 0x08