Check availability of data objects already in analysis phase.

This commit is contained in:
chriseth
2019-07-10 18:49:42 +02:00
parent f3bdc79187
commit 2a5280faa0
7 changed files with 72 additions and 27 deletions
+13 -5
View File
@@ -383,11 +383,19 @@ bool AsmAnalyzer::operator()(FunctionCall const& _funCall)
{
if (!expectExpression(arg))
success = false;
else if (needsLiteralArguments && arg.type() != typeid(Literal))
m_errorReporter.typeError(
_funCall.functionName.location,
"Function expects direct literals as arguments."
);
else if (needsLiteralArguments)
{
if (arg.type() != typeid(Literal))
m_errorReporter.typeError(
_funCall.functionName.location,
"Function expects direct literals as arguments."
);
else if (!m_dataNames.count(boost::get<Literal>(arg).value))
m_errorReporter.typeError(
_funCall.functionName.location,
"Unknown data object \"" + boost::get<Literal>(arg).value.str() + "\"."
);
}
}
// Use argument size instead of parameter count to avoid misleading errors.
m_stackHeight += int(returns) - int(_funCall.arguments.size());