aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-22 17:03:21 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-22 17:03:21 -0300
commitc5ad7e927b7a27f0c38d547fe4d6d66540bc4f75 (patch)
treeb99142bcbf4d6391c901feb7198c36082df4cffb
parent2d01f9d633e74718669bc40e9789ed513dfc8b59 (diff)
Updated ShibokenGenerator::injectedCodeHasReturnValueAttribution.
The method now checks native code injections instead of only target language code.
-rw-r--r--shibokengenerator.cpp16
-rw-r--r--shibokengenerator.h9
2 files changed, 16 insertions, 9 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index d20268184..ebfe58e5e 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -1142,13 +1142,19 @@ bool ShibokenGenerator::injectedCodeCallsPythonOverride(const AbstractMetaFuncti
return false;
}
-bool ShibokenGenerator::injectedCodeHasReturnValueAttribution(const AbstractMetaFunction* func)
+bool ShibokenGenerator::injectedCodeHasReturnValueAttribution(const AbstractMetaFunction* func, TypeSystem::Language language)
{
- static QRegExp retValAttributionRegexCheck("%PYARG_0\\s*=[^=]\\s*.+");
- CodeSnipList snips = func->injectedCodeSnips(CodeSnip::Any, TypeSystem::TargetLangCode);
+ static QRegExp retValAttributionRegexCheck_native("%0\\s*=[^=]\\s*.+");
+ static QRegExp retValAttributionRegexCheck_target("%PYARG_0\\s*=[^=]\\s*.+");
+ CodeSnipList snips = func->injectedCodeSnips(CodeSnip::Any, language);
foreach (CodeSnip snip, snips) {
- if (retValAttributionRegexCheck.indexIn(snip.code()) != -1)
- return true;
+ if (language == TypeSystem::TargetLangCode) {
+ if (retValAttributionRegexCheck_target.indexIn(snip.code()) != -1)
+ return true;
+ } else {
+ if (retValAttributionRegexCheck_native.indexIn(snip.code()) != -1)
+ return true;
+ }
}
return false;
}
diff --git a/shibokengenerator.h b/shibokengenerator.h
index 52a3d7b65..8653a8ed4 100644
--- a/shibokengenerator.h
+++ b/shibokengenerator.h
@@ -156,11 +156,12 @@ public:
/**
* Verifies if any of the function's code injections attributes values to
- * the return variable (%0).
- * \param func the function to check
- * \return true if the function's code attributes values to "%0"
+ * the return variable (%0 or %PYARG_0).
+ * \param func the function to check
+ * \param language the kind of code snip
+ * \return true if the function's code attributes values to "%0" or "%PYARG_0"
*/
- bool injectedCodeHasReturnValueAttribution(const AbstractMetaFunction* func);
+ bool injectedCodeHasReturnValueAttribution(const AbstractMetaFunction* func, TypeSystem::Language language = TypeSystem::TargetLangCode);
/**
* Function which parse the metafunction information