diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-08-06 17:28:00 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:17:09 -0300 |
commit | 714ddb6c74b4db4853ca2e34bb50f2888e75ec8d (patch) | |
tree | 7d04cd087ad99fef6442f6be4fbe0342eb722682 /generator/shibokengenerator.cpp | |
parent | 8794f303c16f67812093d0311530b4447ff5c94c (diff) |
The type checking now pays attention to the <no-null-pointer/> tag.
An unit test was also added for it.
Diffstat (limited to 'generator/shibokengenerator.cpp')
-rw-r--r-- | generator/shibokengenerator.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/generator/shibokengenerator.cpp b/generator/shibokengenerator.cpp index 17cd31a91..54e5b2a2e 100644 --- a/generator/shibokengenerator.cpp +++ b/generator/shibokengenerator.cpp @@ -595,6 +595,25 @@ void ShibokenGenerator::writeToCppConversion(QTextStream& s, const AbstractMetaT s << "toCpp(" << argumentName << ')'; } +bool ShibokenGenerator::shouldRejectNullPointerArgument(const AbstractMetaFunction* func, int argIndex) +{ + if (argIndex < 0 || argIndex >= func->arguments().count()) + return false; + // Argument type is not a pointer, a None rejection should not be + // necessary because the type checking would handle that already. + if (!isPointer(func->arguments().at(argIndex)->type())) + return false; + if (func->argumentRemoved(argIndex + 1)) + return false; + foreach (FunctionModification funcMod, func->modifications()) { + foreach (ArgumentModification argMod, funcMod.argument_mods) { + if (argMod.index == argIndex + 1 && argMod.noNullPointers) + return true; + } + } + return false; +} + QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func, bool incRef) const { QString result; |