From 4b5380126807dee8bc6a0a06c23f787446e2058c Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 4 May 2011 11:05:14 -0300 Subject: Obey type replacements in rich comparison functions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Lauro Moura Renato Araújo --- generator/cppgenerator.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'generator') 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) -- cgit v1.2.3