mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10960 from ethereum/ir-constructor-argument-multiple-slot
[sol2yul] IR constructor argument multiple slot
This commit is contained in:
commit
f81568f684
@ -4255,7 +4255,7 @@ string YulUtilFunctions::copyConstructorArgumentsToMemoryFunction(
|
||||
toString(_contract.id());
|
||||
|
||||
return m_functionCollector.createFunction(functionName, [&]() {
|
||||
string returnParams = suffixedVariableNameList("ret_param_",0, _contract.constructor()->parameters().size());
|
||||
string returnParams = suffixedVariableNameList("ret_param_",0, CompilerUtils::sizeOnStack(_contract.constructor()->parameters()));
|
||||
ABIFunctions abiFunctions(m_evmVersion, m_revertStrings, m_functionCollector);
|
||||
|
||||
return util::Whiskers(R"(
|
||||
|
@ -129,7 +129,7 @@ string IRGenerator::generate(
|
||||
vector<string> constructorParams;
|
||||
if (constructor && !constructor->parameters().empty())
|
||||
{
|
||||
for (size_t i = 0; i < constructor->parameters().size(); ++i)
|
||||
for (size_t i = 0; i < CompilerUtils::sizeOnStack(constructor->parameters()); ++i)
|
||||
constructorParams.emplace_back(m_context.newYulVariable());
|
||||
t(
|
||||
"copyConstructorArguments",
|
||||
|
@ -0,0 +1,9 @@
|
||||
// The IR of this test used to throw
|
||||
contract D {
|
||||
constructor(function() external returns (uint)) {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor(): 0xfdd67305928fcac8d213d1e47bfa6165cd0b87b946644cd0000000000000000 ->
|
@ -0,0 +1,21 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
constructor(function() external pure returns (uint) g) {
|
||||
x = g();
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public returns (uint r) {
|
||||
D d = new D(this.sixteen);
|
||||
r = d.x();
|
||||
}
|
||||
|
||||
function sixteen() public pure returns (uint) {
|
||||
return 16;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 16
|
Loading…
Reference in New Issue
Block a user