aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-10-02 11:00:39 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-10-04 13:44:52 +0200
commit6d4c76578f3228c76d36574fbd50698060a65268 (patch)
tree47a532a99419a71c4974c2faf0f357191d4fc2d4
parent20b7a0a68f1360623ace93551ac68a71d4c078a0 (diff)
shiboken/AbstractMetaArgument: Separate functions
Split out AbstractMetaArgument::hasOriginalDefaultValueExpression() and restrict AbstractMetaArgument::hasDefaultValueExpression() to the effective (removed/modified or original expression). Use hasOriginalDefaultValueExpression() since the affected code is only interested in whether the code has a native default expression. Task-number: PYSIDE-1095 Change-Id: I043ae99c315a8a41295efc2c4a15cd5a6ce74293 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h4
-rw-r--r--sources/shiboken2/generator/generator.cpp9
2 files changed, 8 insertions, 5 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index 9812da001..6ed9dd36d 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -671,7 +671,9 @@ public:
}
bool hasDefaultValueExpression() const
- { return !m_originalExpression.isEmpty() || !m_expression.isEmpty(); }
+ { return !m_expression.isEmpty(); }
+ bool hasOriginalDefaultValueExpression() const
+ { return !m_originalExpression.isEmpty(); }
bool hasUnmodifiedDefaultValueExpression() const
{ return !m_originalExpression.isEmpty() && m_originalExpression == m_expression; }
bool hasModifiedDefaultValueExpression() const
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index 6da9fd933..7c6e921c7 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -760,7 +760,7 @@ DefaultValue Generator::minimalConstructor(const AbstractMetaClass *metaClass) c
bool simple = true;
bool suitable = true;
for (int i = 0, size = arguments.size();
- suitable && i < size && !arguments.at(i)->hasDefaultValueExpression(); ++i) {
+ suitable && i < size && !arguments.at(i)->hasOriginalDefaultValueExpression(); ++i) {
const AbstractMetaArgument *arg = arguments.at(i);
const TypeEntry *aType = arg->type()->typeEntry();
suitable &= aType != cType;
@@ -777,11 +777,12 @@ DefaultValue Generator::minimalConstructor(const AbstractMetaClass *metaClass) c
bool ok = true;
for (int i =0, size = arguments.size(); ok && i < size; ++i) {
const AbstractMetaArgument *arg = arguments.at(i);
- if (arg->hasDefaultValueExpression()) {
- if (arg->hasModifiedDefaultValueExpression())
- args << arg->defaultValueExpression(); // Spell out modified values
+ if (arg->hasModifiedDefaultValueExpression()) {
+ args << arg->defaultValueExpression(); // Spell out modified values
break;
}
+ if (arg->hasOriginalDefaultValueExpression())
+ break;
auto argValue = minimalConstructor(arg->type());
ok &= argValue.isValid();
args << argValue.constructorParameter();