diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-22 16:35:30 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-23 12:30:44 +0200 |
| commit | dce969be54a83dd42d10774f0d4d49b37f8b87b1 (patch) | |
| tree | ce89483e1bd747c4158b346c10efec323921e804 /sources/shiboken6/ApiExtractor/modifications.cpp | |
| parent | 20a32f1a19b063da502926f477fbf2085542d7c0 (diff) | |
shiboken6: Fix injecting documentation for added functions with parameter names
Strip the parameter names from the modification signature so that it
matches the C++ type signature.
Change-Id: I8ca4e124e3c579d222d52f949f0d01b44eae92bf
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/modifications.cpp')
| -rw-r--r-- | sources/shiboken6/ApiExtractor/modifications.cpp | 26 |
1 files changed, 26 insertions, 0 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); |
