aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-22 17:05:45 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-22 17:05:45 -0300
commit53927d41dd236d21e58d2c88371880ebbacf1fef (patch)
treedab4eb1dbec57a9db519f8bfcd4d5438b2b4ec0e
parentc5ad7e927b7a27f0c38d547fe4d6d66540bc4f75 (diff)
Fixed virtual method callers to consider modifications to return type.
Type modifications done to the value expected to be returned by a Python override of a virtual method are now handled properly.
-rw-r--r--cppgenerator.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 23ce9ca38..2a70d94fc 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -530,7 +530,12 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu
s << INDENT << '}' << endl;
s << INDENT << "// Check return type" << endl;
- s << INDENT << "bool typeIsValid = " << cpythonCheckFunction(func->type()) << "(" << PYTHON_RETURN_VAR << ");" << endl;
+ s << INDENT << "bool typeIsValid = ";
+ if (func->typeReplaced(0).isEmpty())
+ s << cpythonCheckFunction(func->type());
+ else
+ s << guessCPythonCheckFunction(func->typeReplaced(0));
+ s << "(" << PYTHON_RETURN_VAR << ");" << endl;
if (func->type()->isQObject() || func->type()->isObject() || func->type()->isValuePointer()) {
s << INDENT << "typeIsValid = typeIsValid || (" << PYTHON_RETURN_VAR << " == Py_None);" << endl;
}