stub-generator: fixed issue when <arg> in <method> does not have "name" property

This commit is contained in:
Lukas Durfina
2018-08-24 14:00:27 +02:00
committed by Stanislav Angelovič
parent ec06462713
commit 108c33faac

View File

@ -108,12 +108,21 @@ std::tuple<std::string, std::string, std::string> BaseGenerator::argsToNamesAndT
{
std::ostringstream argSS, argTypeSS, typeSS;
bool firstArg{true};
for (const auto& arg : args)
for (auto i = 0; i < args.size(); ++i)
{
if (firstArg) firstArg = false; else { argSS << ", "; argTypeSS << ", "; typeSS << ", "; }
auto arg = args.at(i);
if (i > 0)
{
argSS << ", ";
argTypeSS << ", ";
typeSS << ", ";
}
auto argName = arg->get("name");
if (argName.empty())
{
argName = "arg" + std::to_string(i);
}
auto type = signature_to_type(arg->get("type"));
argSS << argName;
argTypeSS << "const " << type << "& " << argName;