Add verbatim builtin.

This commit is contained in:
chriseth
2021-04-26 19:56:44 +02:00
parent 2969bc0f3e
commit e2d8005737
34 changed files with 371 additions and 13 deletions
+14 -4
View File
@@ -369,16 +369,26 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
);
else if (*literalArgumentKind == LiteralKind::String)
{
if (
_funCall.functionName.name.str() == "datasize" ||
_funCall.functionName.name.str() == "dataoffset"
)
string functionName = _funCall.functionName.name.str();
if (functionName == "datasize" || functionName == "dataoffset")
{
if (!m_dataNames.count(get<Literal>(arg).value))
m_errorReporter.typeError(
3517_error,
get<Literal>(arg).location,
"Unknown data object \"" + std::get<Literal>(arg).value.str() + "\"."
);
}
else if (functionName.substr(0, "verbatim_"s.size()) == "verbatim_")
{
if (get<Literal>(arg).value.empty())
m_errorReporter.typeError(
1844_error,
get<Literal>(arg).location,
"The \"verbatim_*\" builtins cannot be used with empty bytecode."
);
}
argTypes.emplace_back(expectUnlimitedStringLiteral(get<Literal>(arg)));
continue;
}