This commit is contained in:
chriseth 2020-12-03 16:08:38 +01:00
parent 35908c602b
commit 1fa371d426
12 changed files with 69 additions and 3 deletions

View File

@ -8,6 +8,8 @@ contract C {
return b + c;
}
}
// ====
// compileViaYul: also
// ----
// f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> 58626
// f(uint16,uint16,uint16): 0x1000, 0xe500, 0xe000 -> FAILURE, hex"4e487b71", 0x11

View File

@ -0,0 +1,22 @@
contract A { constructor(uint) {} }
contract B { constructor(uint) {} }
contract C { constructor(uint) {} }
contract D is A, B, C {
uint[] x;
constructor() m2(f(1)) B(f(2)) m1(f(3)) C(f(4)) m3(f(5)) A(f(6)) {
f(7);
}
function query() public view returns (uint[] memory) { return x; }
modifier m1(uint) { _; }
modifier m2(uint) { _; }
modifier m3(uint) { _; }
function f(uint y) internal returns (uint) { x.push(y); return 0; }
}
// ====
// compileViaYul: also
// ----
// query() -> 0x20, 7, 4, 2, 6, 1, 3, 5, 7

View File

@ -14,6 +14,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(bool): true -> 0
// f(bool): false -> 3

View File

@ -8,6 +8,7 @@ contract C {
r += 1;
}
}
// ====
// compileViaYul: false
// ----
// f() -> 10

View File

@ -0,0 +1,14 @@
contract C {
modifier repeat(uint256 count) {
uint256 i;
for (i = 0; i < count; ++i) _;
}
function f() public repeat(10) returns (uint256 r) {
r += 1;
}
}
// ====
// compileViaYul: true
// ----
// f() -> 1

View File

@ -8,7 +8,8 @@ contract C {
r += 1;
}
}
// ====
// compileViaYul: false
// ----
// f(bool): false -> 1
// f(bool): true -> 2

View File

@ -0,0 +1,15 @@
contract C {
modifier repeat(bool twice) {
if (twice) _;
_;
}
function f(bool twice) public repeat(twice) returns (uint256 r) {
r += 1;
}
}
// ====
// compileViaYul: true
// ----
// f(bool): false -> 1
// f(bool): true -> 1

View File

@ -11,7 +11,8 @@ contract C {
return r;
}
}
// ====
// compileViaYul: false
// ----
// f(bool): false -> 1
// f(bool): true -> 2

View File

@ -10,6 +10,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(uint256): 3 -> 10
// a() -> 10

View File

@ -13,6 +13,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(uint256): 3 -> 10
// a() -> 0

View File

@ -8,6 +8,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(uint256): 9 -> 0x00, 0x00, 0x00, 0x00, 0x00
// f(uint256): 10 -> 0x00, 0x00, 3, 0x00, 0x00

View File

@ -15,6 +15,8 @@ contract C {
}
}
}
// ====
// compileViaYul: also
// ----
// x() -> 0
// f() -> 42