Merge pull request #9026 from ethereum/sol-yul-refactor-new-conditional-whiskers-syntax-in-internal-dispatch

[Sol->Yul] New whiskers conditionals in internal dispatch template (refactor)
This commit is contained in:
chriseth 2020-05-26 17:00:43 +02:00 committed by GitHub
commit b7aa6cb1f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,22 +126,19 @@ string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _ar
string funName = IRNames::internalDispatch(_arity);
return m_functions.createFunction(funName, [&]() {
Whiskers templ(R"(
function <functionName>(fun <comma> <in>) <arrow> <out> {
function <functionName>(fun<?+in>, <in></+in>) <?+out>-> <out></+out> {
switch fun
<#cases>
case <funID>
{
<out> <assignment_op> <name>(<in>)
<?+out> <out> :=</+out> <name>(<in>)
}
</cases>
default { invalid() }
}
)");
templ("functionName", funName);
templ("comma", _arity.in > 0 ? "," : "");
templ("in", suffixedVariableNameList("in_", 0, _arity.in));
templ("arrow", _arity.out > 0 ? "->" : "");
templ("assignment_op", _arity.out > 0 ? ":=" : "");
templ("out", suffixedVariableNameList("out_", 0, _arity.out));
vector<map<string, string>> cases;