aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystem.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-12 15:24:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-15 10:23:24 +0000
commitde6d78fe3d7a41d0b6ef56363e82ffc8fb75119a (patch)
tree28668f50347c09d8d650b6d4660de114358da182 /sources/shiboken2/ApiExtractor/typesystem.cpp
parent16a16dc4d17e5643ddb1656b382a3f8ffe31fd8f (diff)
shiboken: Fix code injection not working for operator functions
Searching for the function modifications of the operator function by signature failed due to the internally changed signature. Store the function modification list of user-added-functions directly in struct AddedFunction instead of the type entry of the containing class. In AbstractMetaFunction, replace the bool m_userAdded flag by a shared pointer to the AddedFunction and use that to retrieve the modifications (injected code snippets) for the user-added functions instead of searching for them by function signature. Task-number: PYSIDE-995 Change-Id: Ic4d0b257f141a450df26563d33beb397b6209d91 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index e35c997d0..079be5377 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -674,6 +674,17 @@ bool Handler::endElement(const QStringRef &localName)
}
}
break;
+ case StackElement::AddFunction: {
+ // Leaving add-function: Assign all modifications to the added function
+ StackElementContext *top = m_contextStack.top();
+ const int modIndex = top->addedFunctionModificationIndex;
+ top->addedFunctionModificationIndex = -1;
+ Q_ASSERT(modIndex >= 0);
+ Q_ASSERT(!top->addedFunctions.isEmpty());
+ while (modIndex < top->functionMods.size())
+ top->addedFunctions.last()->modifications.append(top->functionMods.takeAt(modIndex));
+ }
+ break;
case StackElement::NativeToTarget:
case StackElement::AddConversion: {
CustomConversion* customConversion = static_cast<TypeEntry*>(m_current->entry)->customConversion();
@@ -2025,6 +2036,8 @@ bool Handler::parseAddFunction(const QXmlStreamReader &,
}
m_contextStack.top()->addedFunctions << func;
+ m_contextStack.top()->addedFunctionModificationIndex =
+ m_contextStack.top()->functionMods.size();
FunctionModification mod;
if (!mod.setSignature(m_currentSignature, &m_error))