Skip to content

Commit

Permalink
stub-generator: fixed issue when <arg> in <method> does not have "nam…
Browse files Browse the repository at this point in the history
…e" property
  • Loading branch information
Lukas Durfina authored and Stanislav Angelovič committed Aug 24, 2018
1 parent ec06462 commit 108c33f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions stub-generator/BaseGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 108c33f

Please sign in to comment.