FullInliner: Fix order of arguments of inlined functions

This commit is contained in:
Kamil Śliwak
2023-07-17 16:40:43 +02:00
parent a07f6c443a
commit 5e1e0e7752
12 changed files with 106 additions and 44 deletions
+4 -2
View File
@@ -38,6 +38,8 @@
#include <libsolutil/Visitor.h>
#include <range/v3/action/remove.hpp>
#include <range/v3/view/reverse.hpp>
#include <range/v3/view/zip.hpp>
using namespace std;
using namespace solidity;
@@ -305,8 +307,8 @@ vector<Statement> InlineModifier::performInline(Statement& _statement, FunctionC
newStatements.emplace_back(std::move(varDecl));
};
for (size_t i = 0; i < _funCall.arguments.size(); ++i)
newVariable(function->parameters[i], &_funCall.arguments[i]);
for (auto&& [parameter, argument]: ranges::views::zip(function->parameters, _funCall.arguments) | ranges::views::reverse)
newVariable(parameter, &argument);
for (auto const& var: function->returnVariables)
newVariable(var, nullptr);
+1 -1
View File
@@ -58,8 +58,8 @@ class NameCollector;
*
* function f(a, b) -> c { ... }
*
* let f_a := x
* let f_b := y
* let f_a := x
* let f_c
* code of f, with replacements: a -> f_a, b -> f_b, c -> f_c
* let z := f_c