aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-05-04 11:05:14 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:22 -0300
commit4b5380126807dee8bc6a0a06c23f787446e2058c (patch)
tree31f3a0cc4a95a0ed35e76502b300bdfd6de4df5a /generator
parent71343a4957db5cf0cee9ff925f6bf7154aba9d92 (diff)
Obey type replacements in rich comparison functions.
Reviewer: Lauro Moura <lauro.neto@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'generator')
-rw-r--r--generator/cppgenerator.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 9ea7d9307..8d3179d5e 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -3018,7 +3018,19 @@ void CppGenerator::writeRichCompareFunction(QTextStream& s, const AbstractMetaCl
if (func->isStatic())
continue;
- const AbstractMetaType* type = func->arguments()[0]->type();
+ QString typeReplaced = func->typeReplaced(1);
+ const AbstractMetaType* type = 0;
+ if (typeReplaced.isEmpty())
+ type = func->arguments()[0]->type();
+ else
+ type = buildAbstractMetaTypeFromString(typeReplaced);
+
+ if (!type) {
+ ReportHandler::warning("Unknown type (" + typeReplaced + ") used in type replacement in function "
+ + func->signature() + ", the generated code will be broken !!!");
+ continue;
+ }
+
bool numberType = alternativeNumericTypes == 1 || ShibokenGenerator::isPyInt(type);
if (!comparesWithSameType)