diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-03-26 18:40:22 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:09:58 -0300 |
commit | c583958bc28ab69bc05a7009c9e512d1a227c985 (patch) | |
tree | c8fadfcfd7cc7edf13d2ea64913812f4a4299c8d /abstractmetabuilder.cpp | |
parent | 6b0973be81abe9c67f49336d92370e758b2a44e1 (diff) |
Marks user added constructors with one argument of a custom type as explicit.
This prevents the generation of undesired implicit conversions.
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r-- | abstractmetabuilder.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp index 2d43cc2bd..086c0c7f3 100644 --- a/abstractmetabuilder.cpp +++ b/abstractmetabuilder.cpp @@ -1248,10 +1248,13 @@ void AbstractMetaBuilder::traverseFunctions(ScopeModelItem scopeItem, AbstractMe // Add the functions added by the typesystem foreach (AddedFunction addedFunc, metaClass->typeEntry()->addedFunctions()) { AbstractMetaFunction* func = traverseFunction(addedFunc); - if (func->name() == metaClass->name()) + if (func->name() == metaClass->name()) { func->setFunctionType(AbstractMetaFunction::ConstructorFunction); - else + if (func->arguments().size() == 1 && func->arguments().first()->type()->typeEntry()->isCustom()) + func->setExplicit(true); + } else { func->setFunctionType(AbstractMetaFunction::NormalFunction); + } func->setDeclaringClass(metaClass); func->setImplementingClass(metaClass); metaClass->addFunction(func); |