summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-22 17:07:57 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-22 17:07:57 -0300
commit60b44f86deb16f925dc5fac4602c638c47cbc614 (patch)
treec7bd953ddfcc0b0ee6f1de13bc9baeb2e2323571
parent53927d41dd236d21e58d2c88371880ebbacf1fef (diff)
downloadshiboken-60b44f86deb16f925dc5fac4602c638c47cbc614.tar.gz
shiboken-60b44f86deb16f925dc5fac4602c638c47cbc614.tar.xz
shiboken-60b44f86deb16f925dc5fac4602c638c47cbc614.zip
Fixes virtual method writer to handle modification to return type.
No code is generated for return value conversion on virtual method callers if code is provided to handle said conversion via code injection or custom conversion rule.
-rw-r--r--cppgenerator.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 2a70d94f..6f9a2053 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -546,11 +546,17 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu
s << INDENT << INDENT << ";" << endl;
s << INDENT << "}" << endl;
- s << INDENT;
- s << translateTypeForWrapperMethod(func->type(), func->implementingClass()) << ' ' << CPP_RETURN_VAR << "(";
- writeToCppConversion(s, func->type(), func->implementingClass(), PYTHON_RETURN_VAR);
- s << ')';
- s << ';' << endl;
+ bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, 0).isEmpty();
+ if (hasConversionRule) {
+ CodeSnipList convRule = getReturnConversionRule(TypeSystem::NativeCode, func, "", CPP_RETURN_VAR);
+ writeCodeSnips(s, convRule, CodeSnip::Any, TypeSystem::NativeCode, func);
+ } else if (!injectedCodeHasReturnValueAttribution(func, TypeSystem::NativeCode)) {
+ s << INDENT;
+ s << translateTypeForWrapperMethod(func->type(), func->implementingClass()) << ' ' << CPP_RETURN_VAR << "(";
+ writeToCppConversion(s, func->type(), func->implementingClass(), PYTHON_RETURN_VAR);
+ s << ')';
+ s << ';' << endl;
+ }
}
}