From 108c33faac27048a6052f3f3dbf327b86e5c79f2 Mon Sep 17 00:00:00 2001 From: Lukas Durfina Date: Fri, 24 Aug 2018 14:00:27 +0200 Subject: [PATCH] stub-generator: fixed issue when in does not have "name" property --- stub-generator/BaseGenerator.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/stub-generator/BaseGenerator.cpp b/stub-generator/BaseGenerator.cpp index fe90ef2e..812d2359 100644 --- a/stub-generator/BaseGenerator.cpp +++ b/stub-generator/BaseGenerator.cpp @@ -108,12 +108,21 @@ std::tuple 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;