diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index 3fbcfe746..45ec60d1e 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -36,7 +36,7 @@ YulArity YulArity::fromType(FunctionType const& _functionType) string IRNames::function(FunctionDefinition const& _function) { if (_function.isConstructor()) - return implicitConstructor(*_function.annotation().contract); + return constructor(*_function.annotation().contract); return "fun_" + _function.name() + "_" + to_string(_function.id()); } @@ -78,7 +78,7 @@ string IRNames::internalDispatch(YulArity const& _arity) "_out_" + to_string(_arity.out); } -string IRNames::implicitConstructor(ContractDefinition const& _contract) +string IRNames::constructor(ContractDefinition const& _contract) { return "constructor_" + _contract.name() + "_" + to_string(_contract.id()); } diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index 23d74cd21..4625b91d9 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -54,7 +54,7 @@ struct IRNames static std::string creationObject(ContractDefinition const& _contract); static std::string deployedObject(ContractDefinition const& _contract); static std::string internalDispatch(YulArity const& _arity); - static std::string implicitConstructor(ContractDefinition const& _contract); + static std::string constructor(ContractDefinition const& _contract); static std::string libraryAddressImmutable(); static std::string constantValueFunction(VariableDeclaration const& _constant); static std::string localVariable(VariableDeclaration const& _declaration); diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index b80e892da..776c2afe1 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -137,7 +137,7 @@ string IRGenerator::generate( let := () - () + () @@ -178,10 +178,10 @@ string IRGenerator::generate( } t("constructorParams", joinHumanReadable(constructorParams)); t("constructorHasParams", !constructorParams.empty()); - t("implicitConstructor", IRNames::implicitConstructor(_contract)); + t("constructor", IRNames::constructor(_contract)); t("deploy", deployCode(_contract)); - generateImplicitConstructors(_contract); + generateConstructors(_contract); set creationFunctionList = generateQueuedFunctions(); InternalDispatchMap internalDispatchMap = generateInternalDispatchFunctions(); @@ -710,17 +710,17 @@ string IRGenerator::initStateVariables(ContractDefinition const& _contract) } -void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contract) +void IRGenerator::generateConstructors(ContractDefinition const& _contract) { - auto listAllParams = [&]( - map> const& baseParams) -> vector - { - vector params; - for (ContractDefinition const* contract: _contract.annotation().linearizedBaseContracts) - if (baseParams.count(contract)) - params += baseParams.at(contract); - return params; - }; + auto listAllParams = + [&](map> const& baseParams) -> vector + { + vector params; + for (ContractDefinition const* contract: _contract.annotation().linearizedBaseContracts) + if (baseParams.count(contract)) + params += baseParams.at(contract); + return params; + }; map> baseConstructorParams; for (size_t i = 0; i < _contract.annotation().linearizedBaseContracts.size(); ++i) @@ -729,7 +729,7 @@ void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contra baseConstructorParams.erase(contract); m_context.resetLocalVariables(); - m_context.functionCollector().createFunction(IRNames::implicitConstructor(*contract), [&]() { + m_context.functionCollector().createFunction(IRNames::constructor(*contract), [&]() { Whiskers t(R"( function () { @@ -746,7 +746,7 @@ void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contra vector baseParams = listAllParams(baseConstructorParams); t("baseParams", joinHumanReadable(baseParams)); t("comma", !params.empty() && !baseParams.empty() ? ", " : ""); - t("functionName", IRNames::implicitConstructor(*contract)); + t("functionName", IRNames::constructor(*contract)); pair>> evaluatedArgs = evaluateConstructorArguments(*contract); baseConstructorParams.insert(evaluatedArgs.second.begin(), evaluatedArgs.second.end()); t("evalBaseArguments", evaluatedArgs.first); @@ -754,7 +754,7 @@ void IRGenerator::generateImplicitConstructors(ContractDefinition const& _contra { t("hasNextConstructor", true); ContractDefinition const* nextContract = _contract.annotation().linearizedBaseContracts[i + 1]; - t("nextConstructor", IRNames::implicitConstructor(*nextContract)); + t("nextConstructor", IRNames::constructor(*nextContract)); t("nextParams", joinHumanReadable(listAllParams(baseConstructorParams))); } else diff --git a/libsolidity/codegen/ir/IRGenerator.h b/libsolidity/codegen/ir/IRGenerator.h index 83621f206..7a1b72c0b 100644 --- a/libsolidity/codegen/ir/IRGenerator.h +++ b/libsolidity/codegen/ir/IRGenerator.h @@ -87,10 +87,10 @@ private: /// Generates code that assigns the initial value of the respective type. std::string generateInitialAssignment(VariableDeclaration const& _varDecl); - /// Generates implicit constructors for all contracts in the inheritance hierarchy of + /// Generates constructors for all contracts in the inheritance hierarchy of /// @a _contract - /// If there are user defined constructors, their body will be included in implicit constructors body. - void generateImplicitConstructors(ContractDefinition const& _contract); + /// If there are user defined constructors, their body will be included in the implicit constructor's body. + void generateConstructors(ContractDefinition const& _contract); /// Evaluates constructor's arguments for all base contracts (listed in inheritance specifiers) of /// @a _contract