aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/generator/shiboken/overloaddata.cpp24
-rw-r--r--sources/shiboken6/generator/shiboken/overloaddata.h3
2 files changed, 16 insertions, 11 deletions
diff --git a/sources/shiboken6/generator/shiboken/overloaddata.cpp b/sources/shiboken6/generator/shiboken/overloaddata.cpp
index 5cf3b3f0c..ad358542b 100644
--- a/sources/shiboken6/generator/shiboken/overloaddata.cpp
+++ b/sources/shiboken6/generator/shiboken/overloaddata.cpp
@@ -717,19 +717,23 @@ QList<int> OverloadData::invalidArgumentLengths() const
return invalidArgLengths;
}
+int OverloadData::numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func)
+{
+ int removed = 0;
+ for (int i = 0, size = int(func->arguments().size()); i < size; ++i) {
+ if (func->argumentRemoved(i + 1))
+ ++removed;
+ }
+ return removed;
+}
+
int OverloadData::numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func, int finalArgPos)
{
+ Q_ASSERT(finalArgPos >= 0);
int removed = 0;
- if (finalArgPos < 0) {
- for (int i = 0; i < func->arguments().size(); i++) {
- if (func->argumentRemoved(i + 1))
- removed++;
- }
- } else {
- for (int i = 0; i < finalArgPos + removed; i++) {
- if (func->argumentRemoved(i + 1))
- removed++;
- }
+ for (int i = 0; i < finalArgPos + removed; ++i) {
+ if (func->argumentRemoved(i + 1))
+ ++removed;
}
return removed;
}
diff --git a/sources/shiboken6/generator/shiboken/overloaddata.h b/sources/shiboken6/generator/shiboken/overloaddata.h
index ae7d91715..d9c5bd24c 100644
--- a/sources/shiboken6/generator/shiboken/overloaddata.h
+++ b/sources/shiboken6/generator/shiboken/overloaddata.h
@@ -105,7 +105,8 @@ public:
QList<int> invalidArgumentLengths() const;
- static int numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func, int finalArgPos = -1);
+ static int numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func);
+ static int numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func, int finalArgPos);
/// Returns true if all overloads have no more than one argument.
static bool isSingleArgument(const AbstractMetaFunctionCList &overloads);