Moc: simplify the logic of a for-loop
By handling the special case before entering the loop, then it can become a range-for, which fixes a narrowing conversion warning, and it becomes more readable. Change-Id: I6ce0181c95eae01a4f2bb7cd12fb5cbeba378586 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
0344332c76
commit
cfc098253a
@ -759,12 +759,12 @@ void Generator::generateFunctionParameters(const QList<FunctionDef> &list, const
|
||||
fprintf(out, " ");
|
||||
|
||||
// Types
|
||||
int argsCount = f.arguments.size();
|
||||
for (int j = -1; j < argsCount; ++j) {
|
||||
if (j > -1)
|
||||
fputc(' ', out);
|
||||
const QByteArray &typeName = (j < 0) ? f.normalizedType : f.arguments.at(j).normalizedType;
|
||||
generateTypeInfo(typeName, /*allowEmptyName=*/f.isConstructor);
|
||||
const bool allowEmptyName = f.isConstructor;
|
||||
generateTypeInfo(f.normalizedType, allowEmptyName);
|
||||
fputc(',', out);
|
||||
for (const ArgumentDef &arg : f.arguments) {
|
||||
fputc(' ', out);
|
||||
generateTypeInfo(arg.normalizedType, allowEmptyName);
|
||||
fputc(',', out);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user