Fix source location of yul variable declarations without value.

This commit is contained in:
chriseth
2020-05-12 17:45:19 +02:00
parent efd2f63c2c
commit 7da453014d
3 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -184,11 +184,13 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
}
else
{
m_assembly.setSourceLocation(_varDecl.location);
int variablesLeft = numVariables;
while (variablesLeft--)
m_assembly.appendConstant(u256(0));
}
m_assembly.setSourceLocation(_varDecl.location);
bool atTopOfStack = true;
for (int varIndex = numVariables - 1; varIndex >= 0; --varIndex)
{
@@ -203,7 +205,6 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
if (atTopOfStack)
{
m_context->variableStackHeights.erase(&var);
m_assembly.setSourceLocation(_varDecl.location);
m_assembly.appendInstruction(evmasm::Instruction::POP);
}
else
@@ -216,7 +217,6 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
int slot = *m_unusedStackSlots.begin();
m_unusedStackSlots.erase(m_unusedStackSlots.begin());
m_context->variableStackHeights[&var] = slot;
m_assembly.setSourceLocation(_varDecl.location);
if (int heightDiff = variableHeightDiff(var, varName, true))
m_assembly.appendInstruction(evmasm::swapInstruction(heightDiff - 1));
m_assembly.appendInstruction(evmasm::Instruction::POP);