aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-04-19 16:19:31 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:00 -0300
commit38367298e39ee0710a86fda4aae294fb88981356 (patch)
treef1f6113b1edb2fc724afc63abc01c8396c40d06e /abstractmetabuilder.cpp
parent8241ca049d9e0339a3b7b6b68a38ad826f63eb81 (diff)
Show a warning if a global function defined in typesystem was not found by the parser.
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp62
1 files changed, 37 insertions, 25 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index 8e0e29cf..002e90f6 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -380,6 +380,27 @@ bool AbstractMetaBuilder::build(QIODevice* input)
addAbstractMetaClass(cls);
}
+ // Global functions
+ foreach (FunctionModelItem func, m_dom->functions()) {
+ if (func->accessPolicy() != CodeModel::Public || func->name().startsWith("operator"))
+ continue;
+ FunctionTypeEntry* funcEntry = types->findFunctionType(func->name());
+ if (!funcEntry)
+ continue;
+
+ AbstractMetaFunction* metaFunc = traverseFunction(func);
+ if (!metaFunc)
+ continue;
+
+ if (!funcEntry->hasSignature(metaFunc->minimalSignature())) {
+ delete metaFunc;
+ continue;
+ }
+
+ setInclude(funcEntry, func->fileName());
+ m_globalFunctions << metaFunc;
+ }
+
ReportHandler::setProgressReference(m_metaClasses);
foreach (AbstractMetaClass *cls, m_metaClasses) {
ReportHandler::progress("Fixing class inheritance...");
@@ -426,9 +447,22 @@ bool AbstractMetaBuilder::build(QIODevice* input)
&& !m_metaClasses.findClass(entry->qualifiedCppName())) {
ReportHandler::warning(QString("type '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
.arg(entry->qualifiedCppName()));
- }
-
- if (entry->isEnum()) {
+ } else if (entry->type() == TypeEntry::FunctionType) {
+ const FunctionTypeEntry* fte = static_cast<const FunctionTypeEntry*>(entry);
+ foreach (QString signature, fte->signatures()) {
+ bool ok = false;
+ foreach (AbstractMetaFunction* func, m_globalFunctions) {
+ if (signature == func->minimalSignature()) {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok) {
+ ReportHandler::warning(QString("Global function '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
+ .arg(signature));
+ }
+ }
+ } else if (entry->isEnum()) {
QString pkg = entry->targetLangPackage();
QString name = (pkg.isEmpty() ? QString() : pkg + ".")
+ ((EnumTypeEntry *) entry)->targetLangQualifier();
@@ -508,28 +542,6 @@ bool AbstractMetaBuilder::build(QIODevice* input)
m_currentClass = 0;
- // Global functions
- foreach (FunctionModelItem func, m_dom->functions()) {
- if (func->accessPolicy() != CodeModel::Public || func->name().startsWith("operator"))
- continue;
-
- FunctionTypeEntry* funcEntry = types->findFunctionType(func->name());
- if (!funcEntry)
- continue;
-
- AbstractMetaFunction* metaFunc = traverseFunction(func);
- if (!metaFunc)
- continue;
-
- if (!funcEntry->hasSignature(metaFunc->minimalSignature())) {
- delete metaFunc;
- continue;
- }
-
- setInclude(funcEntry, func->fileName());
- m_globalFunctions << metaFunc;
- }
-
// Functions added to the module on the type system.
foreach (AddedFunction addedFunc, types->globalUserFunctions()) {
AbstractMetaFunction* metaFunc = traverseFunction(addedFunc);