aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-09-21 15:14:22 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:15 -0300
commita2d5bb825977e1f7952a89c64ed2e6e307ae1f78 (patch)
treef0078562ca5b01822a38d96f1c53109d330611aa /generator
parent23162dccb763c81f762ea5e0ec60b3931fe5b5f1 (diff)
Correctly prints the return type of virtual functions instead of a C++ expression.
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 985bcce91..ea4ab03c5 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -580,23 +580,23 @@ static bool allArgumentsRemoved(const AbstractMetaFunction* func)
QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunction* func)
{
if (!func->type())
- return QString();
+ return "\"\"";
if (!func->typeReplaced(0).isEmpty())
- return func->typeReplaced(0);
+ return '"' + func->typeReplaced(0) + '"';
// SbkType would return null when the type is a container.
if (func->type()->typeEntry()->isContainer())
- return reinterpret_cast<const ContainerTypeEntry*>(func->type()->typeEntry())->typeName();
+ return '"' + reinterpret_cast<const ContainerTypeEntry*>(func->type()->typeEntry())->typeName() + '"';
if (avoidProtectedHack()) {
const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(func->type());
if (metaEnum && metaEnum->isProtected())
- return protectedEnumSurrogateName(metaEnum);
+ return '"' + protectedEnumSurrogateName(metaEnum) + '"';
}
if (func->type()->isPrimitive())
- return func->type()->name();
+ return '"' + func->type()->name() + '"';
return QString("Shiboken::SbkType< %1 >()->tp_name").arg(func->type()->typeEntry()->qualifiedCppName());
}
@@ -814,8 +814,8 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
Indentation indent(INDENT);
s << INDENT << "Shiboken::warning(PyExc_RuntimeWarning, 2, "\
"\"Invalid return value in function %s, expected %s, got %s.\", \"";
- s << func->ownerClass()->name() << '.' << funcName << "\", \"" << getVirtualFunctionReturnTypeName(func);
- s << "\", " PYTHON_RETURN_VAR "->ob_type->tp_name);" << endl;
+ s << func->ownerClass()->name() << '.' << funcName << "\", " << getVirtualFunctionReturnTypeName(func);
+ s << ", " PYTHON_RETURN_VAR "->ob_type->tp_name);" << endl;
s << INDENT << "return " << defaultReturnExpr << ';' << endl;
}
s << INDENT << '}' << endl;