summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-09-22 17:58:52 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-10-03 11:31:57 -0300
commitc0d2e563a1aeaf8b32e947248bb5453edd7d2263 (patch)
tree7fa0a8aebd2967903b7b9bef8aa4ec424deaaae1
parentebb972fcc8f8a6c322ded4960e1ed05f4e61fbd0 (diff)
downloadgeneratorrunner-c0d2e563a1aeaf8b32e947248bb5453edd7d2263.tar.gz
generatorrunner-c0d2e563a1aeaf8b32e947248bb5453edd7d2263.tar.xz
generatorrunner-c0d2e563a1aeaf8b32e947248bb5453edd7d2263.zip
Collect the instantiated container types from class fields.
-rw-r--r--generator.cpp18
-rw-r--r--generator.h1
2 files changed, 15 insertions, 4 deletions
diff --git a/generator.cpp b/generator.cpp
index df8c721..71964b4 100644
--- a/generator.cpp
+++ b/generator.cpp
@@ -118,14 +118,24 @@ void Generator::collectInstantiatedContainers(const AbstractMetaFunction* func)
addInstantiatedContainers(arg->type());
}
+void Generator::collectInstantiatedContainers(const AbstractMetaClass* metaClass)
+{
+ if (!metaClass->typeEntry()->generateCode())
+ return;
+ foreach (const AbstractMetaFunction* func, metaClass->functions())
+ collectInstantiatedContainers(func);
+ foreach (const AbstractMetaField* field, metaClass->fields())
+ addInstantiatedContainers(field->type());
+ foreach (AbstractMetaClass* innerClass, metaClass->innerClasses())
+ collectInstantiatedContainers(innerClass);
+}
+
void Generator::collectInstantiatedContainers()
{
foreach (const AbstractMetaFunction* func, globalFunctions())
collectInstantiatedContainers(func);
- foreach (const AbstractMetaClass* metaClass, classes()) {
- foreach (const AbstractMetaFunction* func, metaClass->functions())
- collectInstantiatedContainers(func);
- }
+ foreach (const AbstractMetaClass* metaClass, classes())
+ collectInstantiatedContainers(metaClass);
}
QList<const AbstractMetaType*> Generator::instantiatedContainers() const
diff --git a/generator.h b/generator.h
index 59cef78..14b1fef 100644
--- a/generator.h
+++ b/generator.h
@@ -286,6 +286,7 @@ private:
struct GeneratorPrivate;
GeneratorPrivate* m_d;
void collectInstantiatedContainers(const AbstractMetaFunction* func);
+ void collectInstantiatedContainers(const AbstractMetaClass* metaClass);
void collectInstantiatedContainers();
};