Add LiteralKind to Dialect.literalArguments

Co-authored-by: Daniel Kirchner <daniel@ekpyron.org>
This commit is contained in:
Alex Beregszaszi
2020-08-05 11:37:00 +01:00
co-authored by Daniel Kirchner
parent b8fd409f7f
commit f6a57af809
10 changed files with 51 additions and 55 deletions
+4 -4
View File
@@ -272,14 +272,14 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
auto watcher = m_errorReporter.errorWatcher();
vector<YulString> const* parameterTypes = nullptr;
vector<YulString> const* returnTypes = nullptr;
vector<bool> const* needsLiteralArguments = nullptr;
vector<optional<LiteralKind>> const* literalArguments = nullptr;
if (BuiltinFunction const* f = m_dialect.builtin(_funCall.functionName.name))
{
parameterTypes = &f->parameters;
returnTypes = &f->returns;
if (f->literalArguments)
needsLiteralArguments = &f->literalArguments.value();
if (!f->literalArguments.empty())
literalArguments = &f->literalArguments;
validateInstructions(_funCall);
}
@@ -318,7 +318,7 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
for (size_t i = _funCall.arguments.size(); i > 0; i--)
{
Expression const& arg = _funCall.arguments[i - 1];
bool isLiteralArgument = needsLiteralArguments && (*needsLiteralArguments)[i - 1];
bool isLiteralArgument = literalArguments && (*literalArguments)[i - 1].has_value();
bool isStringLiteral = holds_alternative<Literal>(arg) && get<Literal>(arg).kind == LiteralKind::String;
if (isLiteralArgument && isStringLiteral)