aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.cpp26
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.h6
2 files changed, 28 insertions, 4 deletions
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp
index 263b1d3ac..e7d0aa8a1 100644
--- a/sources/shiboken6/ApiExtractor/modifications.cpp
+++ b/sources/shiboken6/ApiExtractor/modifications.cpp
@@ -436,6 +436,32 @@ AddedFunction::AddedFunctionPtr
return result;
}
+// Remove the parameter names enclosed in '@' from an added function signature
+// so that it matches the C++ type signature.
+static QString removeParameterNames(QString signature)
+{
+ while (true) {
+ const auto ampPos = signature.indexOf(u'@');
+ if (ampPos == -1)
+ break;
+ const auto closingAmpPos = signature.indexOf(u'@', ampPos + 1);
+ if (closingAmpPos == -1)
+ break;
+ signature.remove(ampPos, closingAmpPos - ampPos + 1);
+ }
+ return signature;
+}
+
+DocModification::DocModification(const QString &xpath, const QString &signature) :
+ m_xpath(xpath), m_signature(removeParameterNames(signature))
+{
+}
+
+DocModification::DocModification(TypeSystem::DocModificationMode mode, const QString &signature) :
+ m_signature(removeParameterNames(signature)), m_mode(mode)
+{
+}
+
void DocModification::setCode(const QString &code)
{
m_code = CodeSnipAbstract::fixSpaces(code);
diff --git a/sources/shiboken6/ApiExtractor/modifications.h b/sources/shiboken6/ApiExtractor/modifications.h
index 15c1c02f3..79b32c035 100644
--- a/sources/shiboken6/ApiExtractor/modifications.h
+++ b/sources/shiboken6/ApiExtractor/modifications.h
@@ -523,10 +523,8 @@ class DocModification
{
public:
DocModification() = default;
- explicit DocModification(const QString& xpath, const QString& signature) :
- m_xpath(xpath), m_signature(signature) {}
- explicit DocModification(TypeSystem::DocModificationMode mode, const QString& signature) :
- m_signature(signature), m_mode(mode) {}
+ explicit DocModification(const QString& xpath, const QString& signature);
+ explicit DocModification(TypeSystem::DocModificationMode mode, const QString& signature);
void setCode(const QString& code);
void setCode(QStringView code) { setCode(code.toString()); }