mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[Sol->Yul] Enabling creation function call
This commit is contained in:
@@ -17,5 +17,7 @@ contract B {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004
|
||||
|
||||
@@ -41,5 +41,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 5, 6, 7
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
uint public i;
|
||||
constructor() public {
|
||||
i = 2;
|
||||
}
|
||||
}
|
||||
contract D {
|
||||
function f() public returns (uint r) {
|
||||
return new C().i();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 2
|
||||
@@ -0,0 +1,20 @@
|
||||
contract C {
|
||||
uint public i;
|
||||
constructor(uint newI) public {
|
||||
i = newI;
|
||||
}
|
||||
}
|
||||
contract D {
|
||||
C c;
|
||||
constructor(uint v) public {
|
||||
c = new C(v);
|
||||
}
|
||||
function f() public returns (uint r) {
|
||||
return c.i();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor(): 2 ->
|
||||
// f() -> 2
|
||||
@@ -0,0 +1,21 @@
|
||||
contract C {
|
||||
uint public i;
|
||||
constructor(uint newI) public {
|
||||
i = newI;
|
||||
}
|
||||
}
|
||||
contract D {
|
||||
C c;
|
||||
constructor(uint v) public {
|
||||
c = new C{salt: "abc"}(v);
|
||||
}
|
||||
function f() public returns (uint r) {
|
||||
return c.i();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor(): 2 ->
|
||||
// f() -> 2
|
||||
@@ -36,8 +36,10 @@ contract test {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor(), 20 wei ->
|
||||
// sendAmount(uint256): 5 -> 5
|
||||
// outOfGas() -> FAILURE # call to helper should not succeed but amount should be transferred anyway #
|
||||
// checkState() -> false, 15
|
||||
// checkState() -> false, 15
|
||||
|
||||
@@ -33,6 +33,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// convertParent() -> 1
|
||||
// convertSubA() -> 1, 2
|
||||
|
||||
@@ -19,6 +19,8 @@ contract D {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1
|
||||
// g() -> 5
|
||||
|
||||
+2
@@ -21,5 +21,7 @@ contract B {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// g() -> 42
|
||||
|
||||
+2
@@ -21,5 +21,7 @@ contract B {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// g() -> 42
|
||||
|
||||
@@ -16,5 +16,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor() ->
|
||||
|
||||
@@ -23,6 +23,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 9, 7
|
||||
// t2() -> 9
|
||||
|
||||
@@ -15,6 +15,8 @@ contract D {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor(), 27 wei ->
|
||||
// f() -> 27
|
||||
|
||||
@@ -32,6 +32,7 @@ contract D {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// f() -> 0x1 # This should work, next should throw #
|
||||
|
||||
@@ -34,6 +34,8 @@ contract D {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 3
|
||||
// g() -> 8
|
||||
|
||||
Reference in New Issue
Block a user