Do not prepend function name to all variables when inlining.

This commit is contained in:
chriseth
2019-03-04 18:07:00 +01:00
parent 38831e885d
commit 3f784d6e00
24 changed files with 322 additions and 339 deletions
+3 -3
View File
@@ -177,7 +177,7 @@ vector<Statement> InlineModifier::performInline(Statement& _statement, FunctionC
// helper function to create a new variable that is supposed to model
// an existing variable.
auto newVariable = [&](TypedName const& _existingVariable, Expression* _value) {
YulString newName = m_nameDispenser.newName(_existingVariable.name, function->name);
YulString newName = m_nameDispenser.newName(_existingVariable.name);
variableReplacements[_existingVariable.name] = newName;
VariableDeclaration varDecl{_funCall.location, {{_funCall.location, newName, _existingVariable.type}}, {}};
if (_value)
@@ -192,7 +192,7 @@ vector<Statement> InlineModifier::performInline(Statement& _statement, FunctionC
for (auto const& var: function->returnVariables)
newVariable(var, nullptr);
Statement newBody = BodyCopier(m_nameDispenser, function->name, variableReplacements)(function->body);
Statement newBody = BodyCopier(m_nameDispenser, variableReplacements)(function->body);
newStatements += std::move(boost::get<Block>(newBody).statements);
boost::apply_visitor(GenericFallbackVisitor<Assignment, VariableDeclaration>{
@@ -228,7 +228,7 @@ vector<Statement> InlineModifier::performInline(Statement& _statement, FunctionC
Statement BodyCopier::operator()(VariableDeclaration const& _varDecl)
{
for (auto const& var: _varDecl.variables)
m_variableReplacements[var.name] = m_nameDispenser.newName(var.name, m_varNamePrefix);
m_variableReplacements[var.name] = m_nameDispenser.newName(var.name);
return ASTCopier::operator()(_varDecl);
}