Rename expectedItems to numVariables

This commit is contained in:
Alex Beregszaszi 2017-07-12 19:51:16 +01:00
parent ee3a2c0599
commit 8d90e6fc4e
2 changed files with 6 additions and 6 deletions

View File

@ -37,16 +37,16 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
{ {
solAssert(m_scope, ""); solAssert(m_scope, "");
int const expectedItems = _varDecl.variables.size(); int const numVariables = _varDecl.variables.size();
int height = m_assembly.stackHeight(); int height = m_assembly.stackHeight();
if (_varDecl.value) if (_varDecl.value)
{ {
boost::apply_visitor(*this, *_varDecl.value); boost::apply_visitor(*this, *_varDecl.value);
expectDeposit(expectedItems, height); expectDeposit(numVariables, height);
} }
else else
{ {
int variablesLeft = expectedItems; int variablesLeft = numVariables;
while (variablesLeft--) while (variablesLeft--)
m_assembly.appendConstant(u256(0)); m_assembly.appendConstant(u256(0));
} }

View File

@ -175,19 +175,19 @@ bool AsmAnalyzer::operator()(assembly::Assignment const& _assignment)
bool AsmAnalyzer::operator()(assembly::VariableDeclaration const& _varDecl) bool AsmAnalyzer::operator()(assembly::VariableDeclaration const& _varDecl)
{ {
bool success = true; bool success = true;
int const expectedItems = _varDecl.variables.size(); int const numVariables = _varDecl.variables.size();
if (_varDecl.value) if (_varDecl.value)
{ {
int const stackHeight = m_stackHeight; int const stackHeight = m_stackHeight;
success = boost::apply_visitor(*this, *_varDecl.value); success = boost::apply_visitor(*this, *_varDecl.value);
if ((m_stackHeight - stackHeight) != expectedItems) if ((m_stackHeight - stackHeight) != numVariables)
{ {
m_errorReporter.declarationError(_varDecl.location, "Variable count mismatch."); m_errorReporter.declarationError(_varDecl.location, "Variable count mismatch.");
return false; return false;
} }
} }
else else
m_stackHeight += expectedItems; m_stackHeight += numVariables;
for (auto const& variable: _varDecl.variables) for (auto const& variable: _varDecl.variables)
{ {