Add IRNames::internalDispatch() and use it in IRGenerationContext

This commit is contained in:
Kamil Śliwak 2020-04-28 13:20:39 +02:00
parent 22c0568d34
commit bd75543900
3 changed files with 9 additions and 1 deletions

View File

@ -53,6 +53,13 @@ string IRNames::runtimeObject(ContractDefinition const& _contract)
return _contract.name() + "_" + toString(_contract.id()) + "_deployed";
}
string IRNames::internalDispatch(YulArity const& _arity)
{
return "dispatch_internal"
"_in_" + to_string(_arity.in) +
"_out_" + to_string(_arity.out);
}
string IRNames::implicitConstructor(ContractDefinition const& _contract)
{
return "constructor_" + _contract.name() + "_" + to_string(_contract.id());

View File

@ -50,6 +50,7 @@ struct IRNames
static std::string function(VariableDeclaration const& _varDecl);
static std::string creationObject(ContractDefinition const& _contract);
static std::string runtimeObject(ContractDefinition const& _contract);
static std::string internalDispatch(YulArity const& _arity);
static std::string implicitConstructor(ContractDefinition const& _contract);
static std::string constantValueFunction(VariableDeclaration const& _constant);
static std::string localVariable(VariableDeclaration const& _declaration);

View File

@ -123,7 +123,7 @@ string IRGenerationContext::newYulVariable()
string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _arity)
{
string funName = "dispatch_internal_in_" + to_string(_arity.in) + "_out_" + to_string(_arity.out);
string funName = IRNames::internalDispatch(_arity);
return m_functions.createFunction(funName, [&]() {
Whiskers templ(R"(
function <functionName>(fun <comma> <in>) <arrow> <out> {