aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-04-16 19:39:47 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:00 -0300
commit293dca7e9b7909a54f057cf658bdea7c07fb49ee (patch)
tree843779a17de4c6ee1229e7868146444f1eebc3c9 /abstractmetabuilder.cpp
parent8d37c58c29ca9cea1617e878e1a8a10a7f8ae9c4 (diff)
Fix class dependence in topological sort.
- An inner class depends on their enclosed class. - A class depends on their namespace.
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp31
1 files changed, 4 insertions, 27 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index 797f76d2..1d1cd07b 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -2668,34 +2668,11 @@ AbstractMetaClassList AbstractMetaBuilder::classesTopologicalSorted(const Abstra
if (clazz->isInterface() || !clazz->typeEntry()->generateCode())
continue;
- // check base class dep.
- QString baseClassName(clazz->baseClassName());
- if (!baseClassName.isNull() && baseClassName != clazz->name() && map.contains(baseClassName)) {
- if (clazz->baseClass()->enclosingClass() &&
- clazz->baseClass()->enclosingClass() != clazz->enclosingClass()) {
- baseClassName = clazz->baseClass()->enclosingClass()->name();
- }
- graph.addEdge(map[baseClassName], map[clazz->name()]);
- }
-
- // interfaces...
- foreach (AbstractMetaClass* interface, clazz->interfaces()) {
- if (!interface->typeEntry()->generateCode())
- continue;
-
- if (interface->isInterface())
- interface = interface->primaryInterfaceImplementor();
+ if (clazz->enclosingClass())
+ graph.addEdge(map[clazz->enclosingClass()->name()], map[clazz->name()]);
- if (interface->enclosingClass() &&
- interface->enclosingClass() != clazz->enclosingClass()) {
- baseClassName = interface->enclosingClass()->name();
- } else {
- baseClassName = interface->name();
- }
-
- if (!baseClassName.isNull() && baseClassName != clazz->name() && map.contains(baseClassName))
- graph.addEdge(map[baseClassName], map[clazz->name()]);
- }
+ foreach(AbstractMetaClass* baseClass, getBaseClasses(clazz))
+ graph.addEdge(map[baseClass->name()], map[clazz->name()]);
foreach (AbstractMetaFunction* func, clazz->functions()) {
foreach (AbstractMetaArgument* arg, func->arguments()) {