More renaming.

This commit is contained in:
Roberto Raggi
2010-05-14 14:00:56 +02:00
parent a2128885de
commit 31135d5767
2 changed files with 14 additions and 9 deletions

View File

@@ -42,6 +42,11 @@
#include <QtDebug> #include <QtDebug>
namespace {
const bool debug = ! qgetenv("CPLUSPLUS_LOOKUPCONTEXT_DEBUG").isEmpty();
}
using namespace CPlusPlus; using namespace CPlusPlus;
static void fullyQualifiedName_helper(Symbol *symbol, QList<const Name *> *names) static void fullyQualifiedName_helper(Symbol *symbol, QList<const Name *> *names)
@@ -162,7 +167,7 @@ ClassOrNamespace *LookupContext::globalNamespace() const
ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope) const ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope) const
{ {
if (ClassOrNamespace *b = bindings()->findClassOrNamespace(scope->owner())) if (ClassOrNamespace *b = bindings()->lookupType(scope->owner()))
return b->lookupType(name); return b->lookupType(name);
return 0; return 0;
@@ -170,7 +175,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope) cons
ClassOrNamespace *LookupContext::lookupType(Symbol *symbol) const ClassOrNamespace *LookupContext::lookupType(Symbol *symbol) const
{ {
return bindings()->findClassOrNamespace(symbol); return bindings()->lookupType(symbol);
} }
QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const
@@ -194,7 +199,7 @@ QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const
if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) { if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) {
if (Namespace *enclosingNamespace = u->enclosingNamespaceScope()->owner()->asNamespace()) { if (Namespace *enclosingNamespace = u->enclosingNamespaceScope()->owner()->asNamespace()) {
if (ClassOrNamespace *b = bindings()->findClassOrNamespace(enclosingNamespace)) { if (ClassOrNamespace *b = bindings()->lookupType(enclosingNamespace)) {
if (ClassOrNamespace *uu = b->lookupType(u->name())) { if (ClassOrNamespace *uu = b->lookupType(u->name())) {
candidates = uu->lookup(name); candidates = uu->lookup(name);
@@ -224,7 +229,7 @@ QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const
path.append(name); path.append(name);
} }
if (ClassOrNamespace *binding = bindings()->findClassOrNamespace(path)) if (ClassOrNamespace *binding = bindings()->lookupType(path))
return binding->lookup(name); return binding->lookup(name);
} }
@@ -236,7 +241,7 @@ QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const
} else if (scope->isClassScope() || scope->isNamespaceScope() } else if (scope->isClassScope() || scope->isNamespaceScope()
|| scope->isObjCClassScope() || scope->isObjCProtocolScope()) { || scope->isObjCClassScope() || scope->isObjCProtocolScope()) {
if (ClassOrNamespace *binding = bindings()->findClassOrNamespace(scope->owner())) if (ClassOrNamespace *binding = bindings()->lookupType(scope->owner()))
return binding->lookup(name); return binding->lookup(name);
break; break;
@@ -627,7 +632,7 @@ ClassOrNamespace *CreateBindings::globalNamespace() const
return _globalNamespace; return _globalNamespace;
} }
ClassOrNamespace *CreateBindings::findClassOrNamespace(Symbol *symbol) ClassOrNamespace *CreateBindings::lookupType(Symbol *symbol)
{ {
const QList<const Name *> names = LookupContext::fullyQualifiedName(symbol); const QList<const Name *> names = LookupContext::fullyQualifiedName(symbol);
@@ -642,7 +647,7 @@ ClassOrNamespace *CreateBindings::findClassOrNamespace(Symbol *symbol)
return b; return b;
} }
ClassOrNamespace *CreateBindings::findClassOrNamespace(const QList<const Name *> &path) ClassOrNamespace *CreateBindings::lookupType(const QList<const Name *> &path)
{ {
ClassOrNamespace *e = _globalNamespace->findType(path); ClassOrNamespace *e = _globalNamespace->findType(path);
return e; return e;

View File

@@ -124,11 +124,11 @@ public:
ClassOrNamespace *globalNamespace() const; ClassOrNamespace *globalNamespace() const;
/// Finds the binding associated to the given symbol. /// Finds the binding associated to the given symbol.
ClassOrNamespace *findClassOrNamespace(Symbol *symbol); ClassOrNamespace *lookupType(Symbol *symbol);
/// Find the binding with the given path. /// Find the binding with the given path.
/// \internal /// \internal
ClassOrNamespace *findClassOrNamespace(const QList<const Name *> &path); ClassOrNamespace *lookupType(const QList<const Name *> &path);
/// Returns the Control that must be used to create temporary symbols. /// Returns the Control that must be used to create temporary symbols.
/// \internal /// \internal