Refactor a bit the lookup, it should simplify template instantiation.

This commit is contained in:
Roberto Raggi
2010-05-06 14:01:38 +02:00
parent bc6828ff01
commit 05984e71fc
5 changed files with 110 additions and 63 deletions

View File

@@ -60,9 +60,6 @@ public:
ClassOrNamespace *findClassOrNamespace(const Name *name);
ClassOrNamespace *findClassOrNamespace(const QList<const Name *> &path);
/// \internal
static void lookup_helper(const Name *name, Scope *scope, QList<Symbol *> *result);
private:
/// \internal
void flush();
@@ -78,7 +75,8 @@ private:
void lookup_helper(const Name *name, ClassOrNamespace *binding,
QList<Symbol *> *result,
QSet<ClassOrNamespace *> *processed);
QSet<ClassOrNamespace *> *processed,
const TemplateNameId *templateId);
ClassOrNamespace *lookupClassOrNamespace_helper(const Name *name, QSet<ClassOrNamespace *> *processed);
ClassOrNamespace *findClassOrNamespace_helper(const Name *name, QSet<ClassOrNamespace *> *processed);
@@ -99,6 +97,12 @@ private:
QList<Enum *> _enums;
QList<Symbol *> _todo;
// it's an instantiation.
const TemplateNameId *_templateId;
// templates
QList<ClassOrNamespace *> _instantiations;
friend class CreateBindings;
};
@@ -121,6 +125,13 @@ public:
/// \internal
ClassOrNamespace *allocClassOrNamespace(ClassOrNamespace *parent);
/// \internal
Control *control() const;
/// \internal
void lookup_helper(const Name *name, Scope *scope, QList<Symbol *> *result,
const TemplateNameId *templateId);
protected:
using SymbolVisitor::visit;
@@ -150,6 +161,7 @@ protected:
virtual bool visit(ObjCMethod *);
private:
Control *_control;
Snapshot _snapshot;
QSet<Namespace *> _processed;
QList<ClassOrNamespace *> _entities;