aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index 211c82a41..ac1dcd029 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -168,12 +168,25 @@ void AbstractMetaBuilder::traverseOperatorFunction(FunctionModelItem item)
bool unaryOperator = false;
baseoperandClass = argumentToClass(arguments.at(0));
+
if (arguments.size() == 1) {
unaryOperator = true;
} else if (!baseoperandClass
|| !(baseoperandClass->typeEntry()->codeGeneration() & TypeEntry::GenerateTargetLang)) {
baseoperandClass = argumentToClass(arguments.at(1));
firstArgumentIsSelf = false;
+ } else {
+ bool ok;
+ AbstractMetaType* type = translateType(item->type(), &ok);
+ const TypeEntry* retType = ok ? type->typeEntry() : 0;
+ AbstractMetaClass* otherArgClass = argumentToClass(arguments.at(1));
+ if (otherArgClass && retType
+ && (retType->isValue() || retType->isObject())
+ && retType != baseoperandClass->typeEntry()
+ && retType == otherArgClass->typeEntry()) {
+ baseoperandClass = m_metaClasses.findClass(retType);
+ firstArgumentIsSelf = false;
+ }
}
if (baseoperandClass) {