Display actual error message and not assertion in analysis

This commit is contained in:
Alex Beregszaszi 2017-05-05 21:10:05 +01:00
parent cb4966046d
commit 3451a30e5c

View File

@ -184,7 +184,15 @@ bool AsmAnalyzer::operator()(assembly::VariableDeclaration const& _varDecl)
int const expectedItems = _varDecl.variables.size();
int const stackHeight = m_stackHeight;
bool success = boost::apply_visitor(*this, *_varDecl.value);
solAssert(m_stackHeight - stackHeight == expectedItems, "Invalid value size.");
if ((m_stackHeight - stackHeight) != expectedItems)
{
m_errors.push_back(make_shared<Error>(
Error::Type::DeclarationError,
"Variable count mismatch.",
_varDecl.location
));
return false;
}
for (auto const& variable: _varDecl.variables)
boost::get<Scope::Variable>(m_currentScope->identifiers.at(variable.name)).active = true;