aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystem.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-15 15:23:38 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-15 18:56:52 +0000
commit5b42f97fdfc0334e7628bbe30149227d0834edcd (patch)
treedd2fda6adac647dfe082d750239763cadf10539e /sources/shiboken2/ApiExtractor/typesystem.cpp
parentf42fe9365ba04e31aa8adb7d6d3942990b80104d (diff)
shiboken: Enable adding call operators
The code parsing the add-function tag would clobber call operators (operator()(...)) since it looked for the first '(' to determine the functions name. Add a check for operator(). Change-Id: I3641f670abc0b24c92b539cfba3d227798e84fae Fixes: PYSIDE-995 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 079be5377..52dc2a82f 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -105,6 +105,8 @@ static inline QString yesAttributeValue() { return QStringLiteral("yes"); }
static inline QString trueAttributeValue() { return QStringLiteral("true"); }
static inline QString falseAttributeValue() { return QStringLiteral("false"); }
+static inline QString callOperator() { return QStringLiteral("operator()"); }
+
static QVector<CustomConversion *> customConversionsForReview;
// Set a regular expression for rejection from text. By legacy, those are fixed
@@ -3244,7 +3246,10 @@ AddedFunction::AddedFunction(QString signature, const QString &returnType) :
Q_ASSERT(!returnType.isEmpty());
m_returnType = parseType(returnType);
signature = signature.trimmed();
- int endPos = signature.indexOf(QLatin1Char('('));
+ // Skip past "operator()(...)"
+ const int parenStartPos = signature.startsWith(callOperator())
+ ? callOperator().size() : 0;
+ int endPos = signature.indexOf(QLatin1Char('('), parenStartPos);
if (endPos < 0) {
m_isConst = false;
m_name = signature;