diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2015-04-20 17:42:34 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2015-04-20 14:51:56 +0000 |
commit | cb350bfeb26afaa047f74232b7afc3f143684ef6 (patch) | |
tree | dba299523c5055505cfdc2dc299d092a13094f74 | |
parent | 9e1e11db60995bf4d826b1424802ce96a10e064f (diff) |
C++: Rename ClassOrNamespace -> LookupScope
Change-Id: Ide74482b133dd1fec40a725d9aa81bd749385f37
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
29 files changed, 462 insertions, 465 deletions
diff --git a/src/libs/3rdparty/cplusplus/Names.h b/src/libs/3rdparty/cplusplus/Names.h index 33f40d523d..7b49190f8e 100644 --- a/src/libs/3rdparty/cplusplus/Names.h +++ b/src/libs/3rdparty/cplusplus/Names.h @@ -100,7 +100,7 @@ public: TemplateArgumentIterator firstTemplateArgument() const { return _templateArguments.begin(); } TemplateArgumentIterator lastTemplateArgument() const { return _templateArguments.end(); } bool isSpecialization() const { return _isSpecialization; } - // this is temporary solution needed in ClassOrNamespace::nestedType + // this is temporary solution needed in LookupScope::nestedType // when we try to find correct specialization for instantiation void setIsSpecialization(bool isSpecialization) { _isSpecialization = isSpecialization; } diff --git a/src/libs/cplusplus/CppRewriter.cpp b/src/libs/cplusplus/CppRewriter.cpp index 63eadd912c..fa66e3b4e3 100644 --- a/src/libs/cplusplus/CppRewriter.cpp +++ b/src/libs/cplusplus/CppRewriter.cpp @@ -379,7 +379,7 @@ FullySpecifiedType SubstitutionMap::apply(const Name *name, Rewrite *) const } -UseMinimalNames::UseMinimalNames(ClassOrNamespace *target) +UseMinimalNames::UseMinimalNames(LookupScope *target) : _target(target) { diff --git a/src/libs/cplusplus/CppRewriter.h b/src/libs/cplusplus/CppRewriter.h index cc68f662a5..cb307a9401 100644 --- a/src/libs/cplusplus/CppRewriter.h +++ b/src/libs/cplusplus/CppRewriter.h @@ -89,13 +89,13 @@ private: class CPLUSPLUS_EXPORT UseMinimalNames: public Substitution { public: - UseMinimalNames(ClassOrNamespace *target); + UseMinimalNames(LookupScope *target); virtual ~UseMinimalNames(); virtual FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const; private: - ClassOrNamespace *_target; + LookupScope *_target; }; class CPLUSPLUS_EXPORT UseQualifiedNames: public UseMinimalNames diff --git a/src/libs/cplusplus/Dumpers.cpp b/src/libs/cplusplus/Dumpers.cpp index 1ce4b9a658..cd2ccce71f 100644 --- a/src/libs/cplusplus/Dumpers.cpp +++ b/src/libs/cplusplus/Dumpers.cpp @@ -97,7 +97,7 @@ QString CPlusPlus::toString(const LookupItem &it, const QString &id) return result; } -QString CPlusPlus::toString(const ClassOrNamespace *binding, QString id) +QString CPlusPlus::toString(const LookupScope *binding, QString id) { if (!binding) return QString::fromLatin1("%0: (null)").arg(id); @@ -128,7 +128,7 @@ void CPlusPlus::dump(const LookupItem &it) qDebug() << qPrintable(toString(it)); } -void CPlusPlus::dump(const ClassOrNamespace *binding) +void CPlusPlus::dump(const LookupScope *binding) { qDebug() << qPrintable(toString(binding)); } diff --git a/src/libs/cplusplus/Dumpers.h b/src/libs/cplusplus/Dumpers.h index df8ed64558..c6f358cf57 100644 --- a/src/libs/cplusplus/Dumpers.h +++ b/src/libs/cplusplus/Dumpers.h @@ -45,13 +45,13 @@ QString CPLUSPLUS_EXPORT toString(const Name *name, QString id = QLatin1String(" QString CPLUSPLUS_EXPORT toString(FullySpecifiedType ty, QString id = QLatin1String("Type")); QString CPLUSPLUS_EXPORT toString(const Symbol *s, QString id = QLatin1String("Symbol")); QString CPLUSPLUS_EXPORT toString(const LookupItem &it, const QString &id = QLatin1String("LookupItem")); -QString CPLUSPLUS_EXPORT toString(const ClassOrNamespace *binding, QString id = QLatin1String("ClassOrNamespace")); +QString CPLUSPLUS_EXPORT toString(const LookupScope *binding, QString id = QLatin1String("LookupScope")); void CPLUSPLUS_EXPORT dump(const Name *name); void CPLUSPLUS_EXPORT dump(const FullySpecifiedType &ty); void CPLUSPLUS_EXPORT dump(const Symbol *s); void CPLUSPLUS_EXPORT dump(const LookupItem &it); -void CPLUSPLUS_EXPORT dump(const ClassOrNamespace *binding); +void CPLUSPLUS_EXPORT dump(const LookupScope *binding); } // namespace CPlusPlus diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index fd3f005138..7a6429fd95 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -532,7 +532,7 @@ void FindUsages::memInitializer(MemInitializerAST *ast) if (_currentScope->isFunction()) { Class *classScope = _currentScope->enclosingClass(); if (! classScope) { - if (ClassOrNamespace *binding = _context.lookupType(_currentScope)) { + if (LookupScope *binding = _context.lookupType(_currentScope)) { foreach (Symbol *s, binding->symbols()) { if (Class *k = s->asClass()) { classScope = k; diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index b4e84fd141..4a06284962 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -50,7 +50,7 @@ static const bool debug = ! qgetenv("QTC_LOOKUPCONTEXT_DEBUG").isEmpty(); namespace CPlusPlus { -typedef QSet<Internal::ClassOrNamespacePrivate *> ProcessedSet; +typedef QSet<Internal::LookupScopePrivate *> ProcessedSet; static void addNames(const Name *name, QList<const Name *> *names, bool addAllNames = false) { @@ -214,7 +214,7 @@ static bool symbolIdentical(Symbol *s1, Symbol *s2) return QByteArray(s1->fileName()) == QByteArray(s2->fileName()); } -const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control) +const Name *LookupContext::minimalName(Symbol *symbol, LookupScope *target, Control *control) { const Name *n = 0; QList<const Name *> names = LookupContext::fullyQualifiedName(symbol); @@ -239,7 +239,7 @@ const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target, } QList<LookupItem> LookupContext::lookupByUsing(const Name *name, - ClassOrNamespace *bindingScope) const + LookupScope *bindingScope) const { QList<LookupItem> candidates; // if it is a nameId there can be a using declaration for it @@ -273,7 +273,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name, } else if (const QualifiedNameId *q = name->asQualifiedNameId()) { foreach (Symbol *s, bindingScope->symbols()) { if (Scope *scope = s->asScope()) { - ClassOrNamespace *base = lookupType(q->base(), scope); + LookupScope *base = lookupType(q->base(), scope); if (base) candidates = lookupByUsing(q->name(), base); if (!candidates.isEmpty()) @@ -297,14 +297,14 @@ Document::Ptr LookupContext::document(const QString &fileName) const Snapshot LookupContext::snapshot() const { return _snapshot; } -ClassOrNamespace *LookupContext::globalNamespace() const +LookupScope *LookupContext::globalNamespace() const { return bindings()->globalNamespace(); } -ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope, - ClassOrNamespace *enclosingBinding, - QSet<const Declaration *> typedefsBeingResolved) const +LookupScope *LookupContext::lookupType(const Name *name, Scope *scope, + LookupScope *enclosingBinding, + QSet<const Declaration *> typedefsBeingResolved) const { if (! scope || ! name) { return 0; @@ -312,8 +312,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope, for (unsigned i = 0; i < block->memberCount(); ++i) { Symbol *m = block->memberAt(i); if (UsingNamespaceDirective *u = m->asUsingNamespaceDirective()) { - if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) { - if (ClassOrNamespace *r = uu->lookupType(name)) + if (LookupScope *uu = lookupType(u->name(), scope->enclosingNamespace())) { + if (LookupScope *r = uu->lookupType(name)) return r; } } else if (Declaration *d = m->asDeclaration()) { @@ -346,20 +346,20 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope, } // try to find it in block (rare case but has priority before enclosing scope) // e.g.: void foo() { struct S {}; S s; } - if (ClassOrNamespace *b = bindings()->lookupType(scope, enclosingBinding)) { - if (ClassOrNamespace *classOrNamespaceNestedInNestedBlock = b->lookupType(name, block)) - return classOrNamespaceNestedInNestedBlock; + if (LookupScope *b = bindings()->lookupType(scope, enclosingBinding)) { + if (LookupScope *lookupScopeNestedInNestedBlock = b->lookupType(name, block)) + return lookupScopeNestedInNestedBlock; } // try to find type in enclosing scope(typical case) - if (ClassOrNamespace *found = lookupType(name, scope->enclosingScope())) + if (LookupScope *found = lookupType(name, scope->enclosingScope())) return found; - } else if (ClassOrNamespace *b = bindings()->lookupType(scope, enclosingBinding)) { + } else if (LookupScope *b = bindings()->lookupType(scope, enclosingBinding)) { return b->lookupType(name); } else if (Class *scopeAsClass = scope->asClass()) { if (scopeAsClass->enclosingScope()->isBlock()) { - if (ClassOrNamespace *b = lookupType(scopeAsClass->name(), + if (LookupScope *b = lookupType(scopeAsClass->name(), scopeAsClass->enclosingScope(), enclosingBinding, typedefsBeingResolved)) { @@ -371,8 +371,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope, return 0; } -ClassOrNamespace *LookupContext::lookupType(Symbol *symbol, - ClassOrNamespace *enclosingBinding) const +LookupScope *LookupContext::lookupType(Symbol *symbol, LookupScope *enclosingBinding) const { return bindings()->lookupType(symbol, enclosingBinding); } @@ -399,7 +398,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const for (unsigned i = 0; i < scope->memberCount(); ++i) { if (UsingNamespaceDirective *u = scope->memberAt(i)->asUsingNamespaceDirective()) { - if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) { + if (LookupScope *uu = lookupType(u->name(), scope->enclosingNamespace())) { candidates = uu->find(name); if (! candidates.isEmpty()) @@ -408,8 +407,8 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const } } - if (ClassOrNamespace *bindingScope = bindings()->lookupType(scope)) { - if (ClassOrNamespace *bindingBlock = bindingScope->findBlock(scope->asBlock())) { + if (LookupScope *bindingScope = bindings()->lookupType(scope)) { + if (LookupScope *bindingBlock = bindingScope->findBlock(scope->asBlock())) { candidates = lookupByUsing(name, bindingBlock); if (! candidates.isEmpty()) return candidates; @@ -434,7 +433,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const } if (fun->name() && fun->name()->isQualifiedNameId()) { - if (ClassOrNamespace *binding = bindings()->lookupType(fun)) { + if (LookupScope *binding = bindings()->lookupType(fun)) { candidates = binding->find(name); // try find this name in parent class @@ -470,7 +469,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const || scope->asClass() || (scope->asEnum() && scope->asEnum()->isScoped())) { - if (ClassOrNamespace *bindingScope = bindings()->lookupType(scope)) { + if (LookupScope *bindingScope = bindings()->lookupType(scope)) { candidates = bindingScope->find(name); if (! candidates.isEmpty()) @@ -483,9 +482,9 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const // the scope can be defined inside a block, try to find it if (Block *block = scope->enclosingBlock()) { - if (ClassOrNamespace *b = bindings()->lookupType(block)) { - if (ClassOrNamespace *classOrNamespaceNestedInNestedBlock = b->lookupType(scope->name(), block)) - candidates = classOrNamespaceNestedInNestedBlock->find(name); + if (LookupScope *b = bindings()->lookupType(block)) { + if (LookupScope *lookupScopeNestedInNestedBlock = b->lookupType(scope->name(), block)) + candidates = lookupScopeNestedInNestedBlock->find(name); } } @@ -493,7 +492,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const return candidates; } else if (scope->isObjCClass() || scope->isObjCProtocol()) { - if (ClassOrNamespace *binding = bindings()->lookupType(scope)) + if (LookupScope *binding = bindings()->lookupType(scope)) candidates = binding->find(name); if (! candidates.isEmpty()) @@ -504,10 +503,10 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const return candidates; } -ClassOrNamespace *LookupContext::lookupParent(Symbol *symbol) const +LookupScope *LookupContext::lookupParent(Symbol *symbol) const { QList<const Name *> fqName = path(symbol); - ClassOrNamespace *binding = globalNamespace(); + LookupScope *binding = globalNamespace(); foreach (const Name *name, fqName) { binding = binding->findType(name); if (!binding) @@ -519,67 +518,67 @@ ClassOrNamespace *LookupContext::lookupParent(Symbol *symbol) const namespace Internal { -class ClassOrNamespacePrivate +class LookupScopePrivate { public: - ClassOrNamespacePrivate(ClassOrNamespace *q, CreateBindings *factory, ClassOrNamespace *parent); - ~ClassOrNamespacePrivate(); + LookupScopePrivate(LookupScope *q, CreateBindings *factory, LookupScope *parent); + ~LookupScopePrivate(); - typedef std::map<const Name *, ClassOrNamespacePrivate *, Name::Compare> Table; + typedef std::map<const Name *, LookupScopePrivate *, Name::Compare> Table; typedef std::map<const TemplateNameId *, - ClassOrNamespacePrivate *, + LookupScopePrivate *, TemplateNameId::Compare> TemplateNameIdTable; - typedef QHash<const AnonymousNameId *, ClassOrNamespacePrivate *> Anonymouses; + typedef QHash<const AnonymousNameId *, LookupScopePrivate *> Anonymouses; - ClassOrNamespacePrivate *allocateChild(); + LookupScopePrivate *allocateChild(); void flush(); - ClassOrNamespace *globalNamespace() const; + LookupScope *globalNamespace() const; Symbol *lookupInScope(const QList<const Name *> &fullName); - ClassOrNamespace *findOrCreateType(const Name *name, ClassOrNamespacePrivate *origin = 0, + LookupScope *findOrCreateType(const Name *name, LookupScopePrivate *origin = 0, Class *clazz = 0); - ClassOrNamespacePrivate *findOrCreateNestedAnonymousType(const AnonymousNameId *anonymousNameId); + LookupScopePrivate *findOrCreateNestedAnonymousType(const AnonymousNameId *anonymousNameId); void addTodo(Symbol *symbol); void addSymbol(Symbol *symbol); void addUnscopedEnum(Enum *e); - void addUsing(ClassOrNamespace *u); - void addNestedType(const Name *alias, ClassOrNamespace *e); + void addUsing(LookupScope *u); + void addNestedType(const Name *alias, LookupScope *e); QList<LookupItem> lookup_helper(const Name *name, bool searchInEnclosingScope); - void lookup_helper(const Name *name, ClassOrNamespacePrivate *binding, + void lookup_helper(const Name *name, LookupScopePrivate *binding, QList<LookupItem> *result, ProcessedSet *processed); - ClassOrNamespace *lookupType_helper(const Name *name, ProcessedSet *processed, - bool searchInEnclosingScope, ClassOrNamespacePrivate *origin); + LookupScope *lookupType_helper(const Name *name, ProcessedSet *processed, + bool searchInEnclosingScope, LookupScopePrivate *origin); - ClassOrNamespace *findBlock_helper(Block *block, ProcessedSet *processed, - bool searchInEnclosingScope); + LookupScope *findBlock_helper(Block *block, ProcessedSet *processed, + bool searchInEnclosingScope); - ClassOrNamespacePrivate *nestedType(const Name *name, ClassOrNamespacePrivate *origin); + LookupScopePrivate *nestedType(const Name *name, LookupScopePrivate *origin); - ClassOrNamespacePrivate *findSpecialization(const TemplateNameId *templId, - const TemplateNameIdTable &specializations); + LookupScopePrivate *findSpecialization(const TemplateNameId *templId, + const TemplateNameIdTable &specializations); - ClassOrNamespace *q; + LookupScope *q; CreateBindings *_factory; - ClassOrNamespacePrivate *_parent; + LookupScopePrivate *_parent; QList<Symbol *> _symbols; - QList<ClassOrNamespace *> _usings; - Table _classOrNamespaces; - QHash<Block *, ClassOrNamespace *> _blocks; + QList<LookupScope *> _usings; + Table _nestedScopes; + QHash<Block *, LookupScope *> _blocks; QList<Enum *> _enums; QList<Symbol *> _todo; QSharedPointer<Control> _control; TemplateNameIdTable _specializations; - QMap<const TemplateNameId *, ClassOrNamespacePrivate *> _instantiations; + QMap<const TemplateNameId *, LookupScopePrivate *> _instantiations; Anonymouses _anonymouses; QSet<const AnonymousNameId *> _declaredOrTypedefedAnonymouses; @@ -587,7 +586,7 @@ public: // it's an instantiation. const TemplateNameId *_templateId; - ClassOrNamespacePrivate *_instantiationOrigin; + LookupScopePrivate *_instantiationOrigin; AlreadyConsideredClassContainer<Class> _alreadyConsideredClasses; AlreadyConsideredClassContainer<TemplateNameId> _alreadyConsideredTemplates; @@ -604,9 +603,9 @@ public: , _cloner(cloner) , _subst(subst) {} - void instantiate(ClassOrNamespacePrivate *classOrNamespace, ClassOrNamespacePrivate *instantiation); + void instantiate(LookupScopePrivate *lookupScope, LookupScopePrivate *instantiation); private: - bool isInstantiationNeeded(ClassOrNamespacePrivate *classOrNamespace) const; + bool isInstantiationNeeded(LookupScopePrivate *lookupScope) const; bool containsTemplateType(Declaration *declaration) const; bool containsTemplateType(Function *function) const; NamedType *findNamedType(Type *memberType) const; @@ -617,8 +616,8 @@ private: Subst &_subst; }; -static bool isNestedInstantiationEnclosingTemplate(ClassOrNamespacePrivate *nestedInstantiation, - ClassOrNamespacePrivate *enclosingInstantiation) +static bool isNestedInstantiationEnclosingTemplate(LookupScopePrivate *nestedInstantiation, + LookupScopePrivate *enclosingInstantiation) { ProcessedSet processed; while (enclosingInstantiation && !processed.contains(enclosingInstantiation)) { @@ -631,8 +630,7 @@ static bool isNestedInstantiationEnclosingTemplate(ClassOrNamespacePrivate *nest return true; } -ClassOrNamespacePrivate::ClassOrNamespacePrivate(ClassOrNamespace *q, CreateBindings *factory, - ClassOrNamespace *parent) +LookupScopePrivate::LookupScopePrivate(LookupScope *q, CreateBindings *factory, LookupScope *parent) : q(q) , _factory(factory) , _parent(parent ? parent->d : 0) @@ -644,76 +642,76 @@ ClassOrNamespacePrivate::ClassOrNamespacePrivate(ClassOrNamespace *q, CreateBind Q_ASSERT(factory); } -ClassOrNamespacePrivate::~ClassOrNamespacePrivate() +LookupScopePrivate::~LookupScopePrivate() { delete _scopeLookupCache; } -ClassOrNamespacePrivate *ClassOrNamespacePrivate::allocateChild() +LookupScopePrivate *LookupScopePrivate::allocateChild() { - ClassOrNamespace *e = _factory->allocClassOrNamespace(q); + LookupScope *e = _factory->allocLookupScope(q); return e->d; } } // namespace Internal -ClassOrNamespace::ClassOrNamespace(CreateBindings *factory, ClassOrNamespace *parent) - : d(new Internal::ClassOrNamespacePrivate(this, factory, parent)) +LookupScope::LookupScope(CreateBindings *factory, LookupScope *parent) + : d(new Internal::LookupScopePrivate(this, factory, parent)) { } -ClassOrNamespace::~ClassOrNamespace() +LookupScope::~LookupScope() { delete d; } -ClassOrNamespace *ClassOrNamespace::instantiationOrigin() const +LookupScope *LookupScope::instantiationOrigin() const { - if (Internal::ClassOrNamespacePrivate *i = d->_instantiationOrigin) + if (Internal::LookupScopePrivate *i = d->_instantiationOrigin) return i->q; return 0; } -ClassOrNamespace *ClassOrNamespace::parent() const +LookupScope *LookupScope::parent() const { - if (Internal::ClassOrNamespacePrivate *p = d->_parent) + if (Internal::LookupScopePrivate *p = d->_parent) return p->q; return 0; } -QList<ClassOrNamespace *> ClassOrNamespace::usings() const +QList<LookupScope *> LookupScope::usings() const { - const_cast<ClassOrNamespace *>(this)->d->flush(); + const_cast<LookupScope *>(this)->d->flush(); return d->_usings; } -QList<Enum *> ClassOrNamespace::unscopedEnums() const +QList<Enum *> LookupScope::unscopedEnums() const { - const_cast<ClassOrNamespace *>(this)->d->flush(); + const_cast<LookupScope *>(this)->d->flush(); return d->_enums; } -QList<Symbol *> ClassOrNamespace::symbols() const +QList<Symbol *> LookupScope::symbols() const { - const_cast<ClassOrNamespace *>(this)->d->flush(); + const_cast<LookupScope *>(this)->d->flush(); return d->_symbols; } -QList<LookupItem> ClassOrNamespace::find(const Name *name) +QList<LookupItem> LookupScope::find(const Name *name) { return d->lookup_helper(name, false); } -QList<LookupItem> ClassOrNamespace::lookup(const Name *name) +QList<LookupItem> LookupScope::lookup(const Name *name) { return d->lookup_helper(name, true); } namespace Internal { -ClassOrNamespace *ClassOrNamespacePrivate::globalNamespace() const +LookupScope *LookupScopePrivate::globalNamespace() const { - const ClassOrNamespacePrivate *e = this; + const LookupScopePrivate *e = this; do { if (! e->_parent) @@ -725,7 +723,7 @@ ClassOrNamespace *ClassOrNamespacePrivate::globalNamespace() const return e ? e->q : 0; } -QList<LookupItem> ClassOrNamespacePrivate::lookup_helper(const Name *name, bool searchInEnclosingScope) +QList<LookupItem> LookupScopePrivate::lookup_helper(const Name *name, bool searchInEnclosingScope) { QList<LookupItem> result; @@ -734,7 +732,7 @@ QList<LookupItem> ClassOrNamespacePrivate::lookup_helper(const Name *name, bool if (const QualifiedNameId *qName = name->asQualifiedNameId()) { if (! qName->base()) { // e.g. ::std::string result = globalNamespace()->find(qName->name()); - } else if (ClassOrNamespace *binding = q->lookupType(qName->base())) { + } else if (LookupScope *binding = q->lookupType(qName->base())) { result = binding->find(qName->name()); QList<const Name *> fullName; @@ -745,7 +743,7 @@ QList<LookupItem> ClassOrNamespacePrivate::lookup_helper(const Name *name, bool // in the class but defined outside it - we should capture both. Symbol *match = 0; ProcessedSet processed; - for (ClassOrNamespacePrivate *parentBinding = binding->d->_parent; + for (LookupScopePrivate *parentBinding = binding->d->_parent; parentBinding && !match; parentBinding = parentBinding->_parent) { if (processed.contains(parentBinding)) @@ -767,7 +765,7 @@ QList<LookupItem> ClassOrNamespacePrivate::lookup_helper(const Name *name, bool ProcessedSet processed; ProcessedSet processedOwnParents; - ClassOrNamespacePrivate *binding = this; + LookupScopePrivate *binding = this; do { if (processedOwnParents.contains(binding)) break; @@ -780,8 +778,8 @@ QList<LookupItem> ClassOrNamespacePrivate::lookup_helper(const Name *name, bool return result; } -void ClassOrNamespacePrivate::lookup_helper( - const Name *name, ClassOrNamespacePrivate *binding, QList<LookupItem> *result, +void LookupScopePrivate::lookup_helper( + const Name *name, LookupScopePrivate *binding, QList<LookupItem> *result, ProcessedSet *processed) { if (!binding || processed->contains(binding)) @@ -816,14 +814,14 @@ void ClassOrNamespacePrivate::lookup_helper( foreach (Enum *e, binding->_enums) _factory->lookupInScope(name, e, result, binding->q); - foreach (ClassOrNamespace *u, binding->_usings) + foreach (LookupScope *u, binding->_usings) lookup_helper(name, u->d, result, processed); Anonymouses::const_iterator cit = binding->_anonymouses.constBegin(); Anonymouses::const_iterator citEnd = binding->_anonymouses.constEnd(); for (; cit != citEnd; ++cit) { const AnonymousNameId *anonymousNameId = cit.key(); - ClassOrNamespacePrivate *a = cit.value(); + LookupScopePrivate *a = cit.value(); if (!binding->_declaredOrTypedefedAnonymouses.contains(anonymousNameId)) lookup_helper(name, a, result, processed); } @@ -833,7 +831,7 @@ void ClassOrNamespacePrivate::lookup_helper( void CreateBindings::lookupInScope(const Name *name, Scope *scope, QList<LookupItem> *result, - ClassOrNamespace *binding) + LookupScope *binding) { if (! name) { return; @@ -875,7 +873,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope, item.setBinding(binding); if (s->asNamespaceAlias() && binding) { - ClassOrNamespace *targetNamespaceBinding = binding->lookupType(name); + LookupScope *targetNamespaceBinding = binding->lookupType(name); //there can be many namespace definitions if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() > 0) { Symbol *resolvedSymbol = targetNamespaceBinding->symbols().first(); @@ -898,7 +896,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope, } } -ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name) +LookupScope *LookupScope::lookupType(const Name *name) { if (! name) return 0; @@ -907,15 +905,15 @@ ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name) return d->lookupType_helper(name, &processed, /*searchInEnclosingScope =*/ true, d); } -ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name, Block *block) +LookupScope *LookupScope::lookupType(const Name *name, Block *block) { d->flush(); - QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = d->_blocks.constFind(block); + QHash<Block *, LookupScope *>::const_iterator citBlock = d->_blocks.constFind(block); if (citBlock != d->_blocks.constEnd()) { - ClassOrNamespace *nestedBlock = citBlock.value(); + LookupScope *nestedBlock = citBlock.value(); ProcessedSet processed; - if (ClassOrNamespace *foundInNestedBlock + if (LookupScope *foundInNestedBlock = nestedBlock->d->lookupType_helper(name, &processed, /*searchInEnclosingScope = */ true, @@ -925,23 +923,23 @@ ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name, Block *block) } for (citBlock = d->_blocks.constBegin(); citBlock != d->_blocks.constEnd(); ++citBlock) { - if (ClassOrNamespace *foundNestedBlock = citBlock.value()->lookupType(name, block)) + if (LookupScope *foundNestedBlock = citBlock.value()->lookupType(name, block)) return foundNestedBlock; } return 0; } -ClassOrNamespace *ClassOrNamespace::findType(const Name *name) +LookupScope *LookupScope::findType(const Name *name) { ProcessedSet processed; return d->lookupType_helper(name, &processed, /*searchInEnclosingScope =*/ false, d); } -ClassOrNamespace *Internal::ClassOrNamespacePrivate::findBlock_helper( +LookupScope *Internal::LookupScopePrivate::findBlock_helper( Block *block, ProcessedSet *processed, bool searchInEnclosingScope) { - for (ClassOrNamespacePrivate *binding = this; binding; binding = binding->_parent) { + for (LookupScopePrivate *binding = this; binding; binding = binding->_parent) { if (processed->contains(binding)) break; processed->insert(binding); @@ -952,7 +950,7 @@ ClassOrNamespace *Internal::ClassOrNamespacePrivate::findBlock_helper( return citBlock.value(); for (citBlock = binding->_blocks.begin(); citBlock != end; ++citBlock) { - if (ClassOrNamespace *foundNestedBlock = + if (LookupScope *foundNestedBlock = citBlock.value()->d->findBlock_helper(block, processed, false)) { return foundNestedBlock; } @@ -963,13 +961,13 @@ ClassOrNamespace *Internal::ClassOrNamespacePrivate::findBlock_helper( return 0; } -ClassOrNamespace *ClassOrNamespace::findBlock(Block *block) +LookupScope *LookupScope::findBlock(Block *block) { ProcessedSet processed; return d->findBlock_helper(block, &processed, true); } -Symbol *Internal::ClassOrNamespacePrivate::lookupInScope(const QList<const Name *> &fullName) +Symbol *Internal::LookupScopePrivate::lookupInScope(const QList<const Name *> &fullName) { if (!_scopeLookupCache) { _scopeLookupCache = new QHash<Internal::FullyQualifiedName, Symbol *>; @@ -988,16 +986,16 @@ Symbol *Internal::ClassOrNamespacePrivate::lookupInScope(const QList<const Name return _scopeLookupCache->value(fullName, 0); } -Class *ClassOrNamespace::rootClass() const +Class *LookupScope::rootClass() const { return d->_rootClass; } namespace Internal { -ClassOrNamespace *ClassOrNamespacePrivate::lookupType_helper( +LookupScope *LookupScopePrivate::lookupType_helper( const Name *name, ProcessedSet *processed, - bool searchInEnclosingScope, ClassOrNamespacePrivate *origin) + bool searchInEnclosingScope, LookupScopePrivate *origin) { if (Q_UNLIKELY(debug)) { Overview oo; @@ -1010,7 +1008,7 @@ ClassOrNamespace *ClassOrNamespacePrivate::lookupType_helper( if (! qName->base()) return globalNamespace()->d->lookupType_helper(qName->name(), &innerProcessed, true, origin); - if (ClassOrNamespace *binding = lookupType_helper(qName->base(), processed, true, origin)) + if (LookupScope *binding = lookupType_helper(qName->base(), processed, true, origin)) return binding->d->lookupType_helper(qName->name(), &innerProcessed, false, origin); return 0; @@ -1032,11 +1030,11 @@ ClassOrNamespace *ClassOrNamespacePrivate::lookupType_helper( return q; } - if (ClassOrNamespacePrivate *e = nestedType(name, origin)) + if (LookupScopePrivate *e = nestedType(name, origin)) return e->q; - foreach (ClassOrNamespace *u, _usings) { - if (ClassOrNamespace *r = u->d->lookupType_helper( + foreach (LookupScope *u, _usings) { + if (LookupScope *r = u->d->lookupType_helper( name, processed, /*searchInEnclosingScope =*/ false, origin)) { return r; } @@ -1050,8 +1048,8 @@ ClassOrNamespace *ClassOrNamespacePrivate::lookupType_helper( return 0; } -static ClassOrNamespacePrivate *findSpecializationWithMatchingTemplateArgument( - const Name *argumentName, ClassOrNamespacePrivate *reference) +static LookupScopePrivate *findSpecializationWithMatchingTemplateArgument( + const Name *argumentName, LookupScopePrivate *reference) { foreach (Symbol *s, reference->_symbols) { if (Class *clazz = s->asClass()) { @@ -1073,7 +1071,7 @@ static ClassOrNamespacePrivate *findSpecializationWithMatchingTemplateArgument( return 0; } -ClassOrNamespacePrivate *ClassOrNamespacePrivate::findSpecialization( +LookupScopePrivate *LookupScopePrivate::findSpecialization( const TemplateNameId *templId, const TemplateNameIdTable &specializations) { // we go through all specialization and try to find that one with template argument as pointer @@ -1107,7 +1105,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::findSpecialization( if (const NamedType *argumentNamedType = specArray->elementType().type()->asNamedType()) { if (const Name *argumentName = argumentNamedType->name()) { - if (ClassOrNamespacePrivate *reference + if (LookupScopePrivate *reference = findSpecializationWithMatchingTemplateArgument( argumentName, cit->second)) { return reference; @@ -1122,14 +1120,14 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::findSpecialization( return 0; } -ClassOrNamespacePrivate *ClassOrNamespacePrivate::findOrCreateNestedAnonymousType( +LookupScopePrivate *LookupScopePrivate::findOrCreateNestedAnonymousType( const AnonymousNameId *anonymousNameId) { auto cit = _anonymouses.constFind(anonymousNameId); if (cit != _anonymouses.constEnd()) { return cit.value(); } else { - ClassOrNamespacePrivate *newAnonymous = allocateChild(); + LookupScopePrivate *newAnonymous = allocateChild(); if (Q_UNLIKELY(debug)) newAnonymous->_name = anonymousNameId; _anonymouses[anonymousNameId] = newAnonymous; @@ -1137,28 +1135,28 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::findOrCreateNestedAnonymousTyp } } -ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( - const Name *name, ClassOrNamespacePrivate *origin) +LookupScopePrivate *LookupScopePrivate::nestedType( + const Name *name, LookupScopePrivate *origin) { Q_ASSERT(name != 0); Q_ASSERT(name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()); - const_cast<ClassOrNamespacePrivate *>(this)->flush(); + const_cast<LookupScopePrivate *>(this)->flush(); if (const AnonymousNameId *anonymousNameId = name->asAnonymousNameId()) return findOrCreateNestedAnonymousType(anonymousNameId); - Table::const_iterator it = _classOrNamespaces.find(name); - if (it == _classOrNamespaces.end()) + Table::const_iterator it = _nestedScopes.find(name); + if (it == _nestedScopes.end()) return 0; - ClassOrNamespacePrivate *reference = it->second; - ClassOrNamespacePrivate *baseTemplateClassReference = reference; + LookupScopePrivate *reference = it->second; + LookupScopePrivate *baseTemplateClassReference = reference; reference->flush(); const TemplateNameId *templId = name->asTemplateNameId(); if (templId) { - // for "using" we should use the real one ClassOrNamespace(it should be the first + // for "using" we should use the real one LookupScope(it should be the first // one item from usings list) // we indicate that it is a 'using' by checking number of symbols(it should be 0) if (reference->_symbols.count() == 0 && reference->_usings.count() != 0) @@ -1175,7 +1173,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( if (cit != reference->_specializations.end()) { return cit->second; } else { - ClassOrNamespacePrivate *newSpecialization = reference->allocateChild(); + LookupScopePrivate *newSpecialization = reference->allocateChild(); if (Q_UNLIKELY(debug)) newSpecialization->_name = templId; reference->_specializations[templId] = newSpecialization; @@ -1195,7 +1193,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( // we found full specialization reference = cit->second; } else { - ClassOrNamespacePrivate *specializationWithPointer + LookupScopePrivate *specializationWithPointer = findSpecialization(templId, specializations); if (specializationWithPointer) reference = specializationWithPointer; @@ -1236,13 +1234,13 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( if (!name->isTemplateNameId()) _alreadyConsideredClasses.insert(referenceClass); - QSet<ClassOrNamespace *> knownUsings = reference->_usings.toSet(); + QSet<LookupScope *> knownUsings = reference->_usings.toSet(); // If we are dealling with a template type, more work is required, since we need to // construct all instantiation data. if (templId) { _alreadyConsideredTemplates.insert(templId); - ClassOrNamespacePrivate *instantiation = baseTemplateClassReference->allocateChild(); + LookupScopePrivate *instantiation = baseTemplateClassReference->allocateChild(); if (Q_UNLIKELY(debug)) instantiation->_name = templId; @@ -1326,7 +1324,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( templParams.insert(templateSpecialization->templateParameterAt(i)->name(), i); foreach (const Name *baseName, allBases) { - ClassOrNamespace *baseBinding = 0; + LookupScope *baseBinding = 0; if (const Identifier *nameId = baseName->asNameId()) { // This is the simple case in which a template parameter is itself a base. @@ -1368,13 +1366,13 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( // Another template that uses the dependent name. // Ex.: template <class T> class A : public B<T> {}; if (baseTemplId->identifier() != templId->identifier()) { - if (ClassOrNamespacePrivate *nested = nestedType(baseName, origin)) + if (LookupScopePrivate *nested = nestedType(baseName, origin)) baseBinding = nested->q; } } else if (const QualifiedNameId *qBaseName = baseName->asQualifiedNameId()) { // Qualified names in general. // Ex.: template <class T> class A : public B<T>::Type {}; - ClassOrNamespace *binding = q; + LookupScope *binding = q; if (const Name *qualification = qBaseName->base()) { const TemplateNameId *baseTemplName = qualification->asTemplateNameId(); if (!baseTemplName || !compareName(baseTemplName, templateSpecialization->name())) @@ -1391,7 +1389,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( instantiation->addUsing(baseBinding); } } else { - instantiation->_classOrNamespaces = reference->_classOrNamespaces; + instantiation->_nestedScopes = reference->_nestedScopes; instantiation->_symbols.append(reference->_symbols); } @@ -1406,7 +1404,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( // Find the missing bases for regular (non-template) types. // Ex.: class A : public B<Some>::Type {}; foreach (const Name *baseName, allBases) { - ClassOrNamespace *binding = q; + LookupScope *binding = q; if (const QualifiedNameId *qBaseName = baseName->asQualifiedNameId()) { if (const Name *qualification = qBaseName->base()) binding = q->lookupType(qualification); @@ -1421,7 +1419,7 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( } if (binding) { - ClassOrNamespace * baseBinding = binding->lookupType(baseName); + LookupScope * baseBinding = binding->lookupType(baseName); if (baseBinding && !knownUsings.contains(baseBinding)) reference->addUsing(baseBinding); } @@ -1431,26 +1429,26 @@ ClassOrNamespacePrivate *ClassOrNamespacePrivate::nestedType( return reference; } -void Instantiator::instantiate(ClassOrNamespacePrivate *classOrNamespace, - ClassOrNamespacePrivate *instantiation) +void Instantiator::instantiate(LookupScopePrivate *lookupScope, + LookupScopePrivate *instantiation) { - if (_alreadyConsideredInstantiations.contains(classOrNamespace)) + if (_alreadyConsideredInstantiations.contains(lookupScope)) return; - _alreadyConsideredInstantiations.insert(classOrNamespace); - auto cit = classOrNamespace->_classOrNamespaces.begin(); - for (; cit != classOrNamespace->_classOrNamespaces.end(); ++cit) { + _alreadyConsideredInstantiations.insert(lookupScope); + auto cit = lookupScope->_nestedScopes.begin(); + for (; cit != lookupScope->_nestedScopes.end(); ++cit) { const Name *nestedName = cit->first; - ClassOrNamespacePrivate *nestedClassOrNamespace = cit->second; - ClassOrNamespacePrivate *nestedInstantiation = nestedClassOrNamespace; - nestedClassOrNamespace->flush(); + LookupScopePrivate *nestedLookupScope = cit->second; + LookupScopePrivate *nestedInstantiation = nestedLookupScope; + nestedLookupScope->flush(); - if (isInstantiationNeeded(nestedClassOrNamespace)) { - nestedInstantiation = nestedClassOrNamespace->allocateChild(); - nestedInstantiation->_enums.append(nestedClassOrNamespace->_enums); - nestedInstantiation->_usings.append(nestedClassOrNamespace->_usings); - nestedInstantiation->_instantiationOrigin = nestedClassOrNamespace; + if (isInstantiationNeeded(nestedLookupScope)) { + nestedInstantiation = nestedLookupScope->allocateChild(); + nestedInstantiation->_enums.append(nestedLookupScope->_enums); + nestedInstantiation->_usings.append(nestedLookupScope->_usings); + nestedInstantiation->_instantiationOrigin = nestedLookupScope; - foreach (Symbol *s, nestedClassOrNamespace->_symbols) { + foreach (Symbol *s, nestedLookupScope->_symbols) { Symbol *clone = _cloner.symbol(s, &_subst); if (!clone->enclosingScope()) // Not from the cache but just cloned. clone->setEnclosingScope(s->enclosingScope()); @@ -1458,18 +1456,18 @@ void Instantiator::instantiate(ClassOrNamespacePrivate *classOrNamespace, } } - if (isNestedInstantiationEnclosingTemplate(nestedInstantiation, classOrNamespace)) + if (isNestedInstantiationEnclosingTemplate(nestedInstantiation, lookupScope)) nestedInstantiation->_parent = instantiation; - instantiate(nestedClassOrNamespace, nestedInstantiation); + instantiate(nestedLookupScope, nestedInstantiation); - instantiation->_classOrNamespaces[nestedName] = nestedInstantiation; + instantiation->_nestedScopes[nestedName] = nestedInstantiation; } - _alreadyConsideredInstantiations.remove(classOrNamespace); + _alreadyConsideredInstantiations.remove(lookupScope); } -bool Instantiator::isInstantiationNeeded(ClassOrNamespacePrivate *classOrNamespace) const +bool Instantiator::isInstantiationNeeded(LookupScopePrivate *lookupScope) const { - foreach (Symbol *s, classOrNamespace->_symbols) { + foreach (Symbol *s, lookupScope->_symbols) { if (Class *klass = s->asClass()) { int memberCount = klass->memberCount(); for (int i = 0; i < memberCount; ++i) { @@ -1515,7 +1513,7 @@ NamedType *Instantiator::findNamedType(Type *memberType) const return 0; } -void ClassOrNamespacePrivate::flush() +void LookupScopePrivate::flush() { if (! _todo.isEmpty()) { const QList<Symbol *> todo = _todo; @@ -1526,33 +1524,33 @@ void ClassOrNamespacePrivate::flush() } } -void ClassOrNamespacePrivate::addSymbol(Symbol *symbol) +void LookupScopePrivate::addSymbol(Symbol *symbol) { _symbols.append(symbol); } -void ClassOrNamespacePrivate::addTodo(Symbol *symbol) +void LookupScopePrivate::addTodo(Symbol *symbol) { _todo.append(symbol); } -void ClassOrNamespacePrivate::addUnscopedEnum(Enum *e) +void LookupScopePrivate::addUnscopedEnum(Enum *e) { _enums.append(e); } -void ClassOrNamespacePrivate::addUsing(ClassOrNamespace *u) +void LookupScopePrivate::addUsing(LookupScope *u) { _usings.append(u); } -void ClassOrNamespacePrivate::addNestedType(const Name *alias, ClassOrNamespace *e) +void LookupScopePrivate::addNestedType(const Name *alias, LookupScope *e) { - _classOrNamespaces[alias] = e ? e->d : 0; + _nestedScopes[alias] = e ? e->d : 0; } -ClassOrNamespace *ClassOrNamespacePrivate::findOrCreateType( - const Name *name, ClassOrNamespacePrivate *origin, Class *clazz) +LookupScope *LookupScopePrivate::findOrCreateType( + const Name *name, LookupScopePrivate *origin, Class *clazz) { if (! name) return q; @@ -1566,14 +1564,14 @@ ClassOrNamespace *ClassOrNamespacePrivate::findOrCreateType( return findOrCreateType(qName->base(), origin)->d->findOrCreateType(qName->name(), origin, clazz); } else if (name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) { - ClassOrNamespacePrivate *e = nestedType(name, origin); + LookupScopePrivate *e = nestedType(name, origin); if (! e) { e = allocateChild(); e->_rootClass = clazz; if (Q_UNLIKELY(debug)) e->_name = name; - _classOrNamespaces[name] = e; + _nestedScopes[name] = e; } return e->q; @@ -1589,8 +1587,8 @@ CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snaps , _control(QSharedPointer<Control>(new Control)) , _expandTemplates(false) { - _globalNamespace = allocClassOrNamespace(/*parent = */ 0); - _currentClassOrNamespace = _globalNamespace; + _globalNamespace = allocLookupScope(/*parent = */ 0); + _currentLookupScope = _globalNamespace; process(thisDocument); } @@ -1600,36 +1598,36 @@ CreateBindings::~CreateBindings() qDeleteAll(_entities); } -ClassOrNamespace *CreateBindings::switchCurrentClassOrNamespace(ClassOrNamespace *classOrNamespace) +LookupScope *CreateBindings::switchCurrentLookupScope(LookupScope *lookupScope) { - ClassOrNamespace *previous = _currentClassOrNamespace; - _currentClassOrNamespace = classOrNamespace; + LookupScope *previous = _currentLookupScope; + _currentLookupScope = lookupScope; return previous; } -ClassOrNamespace *CreateBindings::globalNamespace() const +LookupScope *CreateBindings::globalNamespace() const { return _globalNamespace; } -ClassOrNamespace *CreateBindings::lookupType(Symbol *symbol, ClassOrNamespace *enclosingBinding) +LookupScope *CreateBindings::lookupType(Symbol *symbol, LookupScope *enclosingBinding) { const QList<const Name *> path = LookupContext::path(symbol); return lookupType(path, enclosingBinding); } -ClassOrNamespace *CreateBindings::lookupType(const QList<const Name *> &path, - ClassOrNamespace *enclosingBinding) +LookupScope *CreateBindings::lookupType(const QList<const Name *> &path, + LookupScope *enclosingBinding) { if (path.isEmpty()) return _globalNamespace; if (enclosingBinding) { - if (ClassOrNamespace *b = enclosingBinding->lookupType(path.last())) + if (LookupScope *b = enclosingBinding->lookupType(path.last())) return b; } - ClassOrNamespace *b = _globalNamespace->lookupType(path.at(0)); + LookupScope *b = _globalNamespace->lookupType(path.at(0)); for (int i = 1; b && i < path.size(); ++i) b = b->findType(path.at(i)); @@ -1637,21 +1635,21 @@ ClassOrNamespace *CreateBindings::lookupType(const QList<const Name *> &path, return b; } -void CreateBindings::process(Symbol *s, ClassOrNamespace *classOrNamespace) +void CreateBindings::process(Symbol *s, LookupScope *lookupScope) { - ClassOrNamespace *previous = switchCurrentClassOrNamespace(classOrNamespace); + LookupScope *previous = switchCurrentLookupScope(lookupScope); accept(s); - (void) switchCurrentClassOrNamespace(previous); + (void) switchCurrentLookupScope(previous); } void CreateBindings::process(Symbol *symbol) { - _currentClassOrNamespace->d->addTodo(symbol); + _currentLookupScope->d->addTodo(symbol); } -ClassOrNamespace *CreateBindings::allocClassOrNamespace(ClassOrNamespace *parent) +LookupScope *CreateBindings::allocLookupScope(LookupScope *parent) { - ClassOrNamespace *e = new ClassOrNamespace(this, parent); + LookupScope *e = new LookupScope(this, parent); e->d->_control = control(); _entities.append(e); return e; @@ -1676,22 +1674,22 @@ void CreateBindings::process(Document::Ptr doc) } } -ClassOrNamespace *CreateBindings::enterClassOrNamespaceBinding(Symbol *symbol) +LookupScope *CreateBindings::enterLookupScopeBinding(Symbol *symbol) { - ClassOrNamespace *entity = _currentClassOrNamespace->d->findOrCreateType( + LookupScope *entity = _currentLookupScope->d->findOrCreateType( symbol->name(), 0, symbol->asClass()); entity->d->addSymbol(symbol); - return switchCurrentClassOrNamespace(entity); + return switchCurrentLookupScope(entity); } -ClassOrNamespace *CreateBindings::enterGlobalClassOrNamespace(Symbol *symbol) +LookupScope *CreateBindings::enterGlobalLookupScope(Symbol *symbol) { - ClassOrNamespace *entity = _globalNamespace->d->findOrCreateType( + LookupScope *entity = _globalNamespace->d->findOrCreateType( symbol->name(), 0, symbol->asClass()); entity->d->addSymbol(symbol); - return switchCurrentClassOrNamespace(entity); + return switchCurrentLookupScope(entity); } bool CreateBindings::visit(Template *templ) @@ -1704,32 +1702,32 @@ bool CreateBindings::visit(Template *templ) bool CreateBindings::visit(Namespace *ns) { - ClassOrNamespace *previous = enterClassOrNamespaceBinding(ns); + LookupScope *previous = enterLookupScopeBinding(ns); for (unsigned i = 0; i < ns->memberCount(); ++i) process(ns->memberAt(i)); if (ns->isInline() && previous) - previous->d->addUsing(_currentClassOrNamespace); + previous->d->addUsing(_currentLookupScope); - _currentClassOrNamespace = previous; + _currentLookupScope = previous; return false; } bool CreateBindings::visit(Class *klass) { - ClassOrNamespace *previous = _currentClassOrNamespace; - ClassOrNamespace *binding = 0; + LookupScope *previous = _currentLookupScope; + LookupScope *binding = 0; if (klass->name() && klass->name()->isQualifiedNameId()) - binding = _currentClassOrNamespace->lookupType(klass->name()); + binding = _currentLookupScope->lookupType(klass->name()); if (! binding) - binding = _currentClassOrNamespace->d->findOrCreateType(klass->name(), 0, klass); + binding = _currentLookupScope->d->findOrCreateType(klass->name(), 0, klass); - _currentClassOrNamespace = binding; - _currentClassOrNamespace->d->addSymbol(klass); + _currentLookupScope = binding; + _currentLookupScope->d->addSymbol(klass); for (unsigned i = 0; i < klass->baseClassCount(); ++i) process(klass->baseClassAt(i)); @@ -1737,15 +1735,15 @@ bool CreateBindings::visit(Class *klass) for (unsigned i = 0; i < klass->memberCount(); ++i) process(klass->memberAt(i)); - _currentClassOrNamespace = previous; + _currentLookupScope = previous; return false; } bool CreateBindings::visit(ForwardClassDeclaration *klass) { if (! klass->isFriend()) { - ClassOrNamespace *previous = enterClassOrNamespaceBinding(klass); - _currentClassOrNamespace = previous; + LookupScope *previous = enterLookupScopeBinding(klass); + _currentLookupScope = previous; } return false; @@ -1754,10 +1752,10 @@ bool CreateBindings::visit(ForwardClassDeclaration *klass) bool CreateBindings::visit(Enum *e) { if (e->isScoped()) { - ClassOrNamespace *previous = enterClassOrNamespaceBinding(e); - _currentClassOrNamespace = previous; + LookupScope *previous = enterLookupScopeBinding(e); + _currentLookupScope = previous; } else { - _currentClassOrNamespace->d->addUnscopedEnum(e); + _currentLookupScope->d->addUnscopedEnum(e); } return false; } @@ -1770,16 +1768,16 @@ bool CreateBindings::visit(Declaration *decl) if (typedefId && ! (ty.isConst() || ty.isVolatile())) { if (const NamedType *namedTy = ty->asNamedType()) { - if (ClassOrNamespace *e = _currentClassOrNamespace->lookupType(namedTy->name())) { - _currentClassOrNamespace->d->addNestedType(decl->name(), e); + if (LookupScope *e = _currentLookupScope->lookupType(namedTy->name())) { + _currentLookupScope->d->addNestedType(decl->name(), e); } else if (false) { Overview oo; qDebug() << "found entity not found for" << oo.prettyName(namedTy->name()); } } else if (Class *klass = ty->asClassType()) { if (const Identifier *nameId = decl->name()->asNameId()) { - ClassOrNamespace *binding - = _currentClassOrNamespace->d->findOrCreateType(nameId, 0, klass); + LookupScope *binding + = _currentLookupScope->d->findOrCreateType(nameId, 0, klass); binding->d->addSymbol(klass); } } @@ -1788,7 +1786,7 @@ bool CreateBindings::visit(Declaration *decl) if (Class *clazz = decl->type()->asClassType()) { if (const Name *name = clazz->name()) { if (const AnonymousNameId *anonymousNameId = name->asAnonymousNameId()) - _currentClassOrNamespace->d->_declaredOrTypedefedAnonymouses.insert(anonymousNameId); + _currentLookupScope->d->_declaredOrTypedefedAnonymouses.insert(anonymousNameId); } } return false; @@ -1796,42 +1794,42 @@ bool CreateBindings::visit(Declaration *decl) bool CreateBindings::visit(Function *function) { - ClassOrNamespace *previous = _currentClassOrNamespace; - ClassOrNamespace *binding = lookupType(function, previous); + LookupScope *previous = _currentLookupScope; + LookupScope *binding = lookupType(function, previous); if (!binding) return false; - _currentClassOrNamespace = binding; + _currentLookupScope = binding; for (unsigned i = 0, count = function->memberCount(); i < count; ++i) { Symbol *s = function->memberAt(i); if (Block *b = s->asBlock()) visit(b); } - _currentClassOrNamespace = previous; + _currentLookupScope = previous; return false; } bool CreateBindings::visit(Block *block) { - ClassOrNamespace *previous = _currentClassOrNamespace; + LookupScope *previous = _currentLookupScope; - ClassOrNamespace *binding = new ClassOrNamespace(this, previous); + LookupScope *binding = new LookupScope(this, previous); binding->d->_control = control(); - _currentClassOrNamespace = binding; - _currentClassOrNamespace->d->addSymbol(block); + _currentLookupScope = binding; + _currentLookupScope->d->addSymbol(block); for (unsigned i = 0; i < block->memberCount(); ++i) // we cannot use lazy processing here, because we have to know - // does this block contain any other blocks or classOrNamespaces - process(block->memberAt(i), _currentClassOrNamespace); - - // we add this block to parent ClassOrNamespace only if it contains - // any nested ClassOrNamespaces or other blocks(which have to contain - // nested ClassOrNamespaces) - if (! _currentClassOrNamespace->d->_blocks.empty() - || ! _currentClassOrNamespace->d->_classOrNamespaces.empty() - || ! _currentClassOrNamespace->d->_enums.empty() - || ! _currentClassOrNamespace->d->_anonymouses.empty()) { + // does this block contain any other blocks or LookupScopes + process(block->memberAt(i), _currentLookupScope); + + // we add this block to parent LookupScope only if it contains + // any nested LookupScopes or other blocks(which have to contain + // nested LookupScopes) + if (! _currentLookupScope->d->_blocks.empty() + || ! _currentLookupScope->d->_nestedScopes.empty() + || ! _currentLookupScope->d->_enums.empty() + || ! _currentLookupScope->d->_anonymouses.empty()) { previous->d->_blocks[block] = binding; _entities.append(binding); } else { @@ -1839,15 +1837,15 @@ bool CreateBindings::visit(Block *block) binding = 0; } - _currentClassOrNamespace = previous; + _currentLookupScope = previous; return false; } bool CreateBindings::visit(BaseClass *b) { - if (ClassOrNamespace *base = _currentClassOrNamespace->lookupType(b->name())) { - _currentClassOrNamespace->d->addUsing(base); + if (LookupScope *base = _currentLookupScope->lookupType(b->name())) { + _currentLookupScope->d->addUsing(base); } else if (false) { Overview oo; qDebug() << "no entity for:" << oo.prettyName(b->name()); @@ -1860,8 +1858,8 @@ bool CreateBindings::visit(UsingDeclaration *u) if (u->name()) { if (const QualifiedNameId *q = u->name()->asQualifiedNameId()) { if (const Identifier *unqualifiedId = q->name()->asNameId()) { - if (ClassOrNamespace *delegate = _currentClassOrNamespace->lookupType(q)) { - ClassOrNamespace *b = _currentClassOrNamespace->d->findOrCreateType(unqualifiedId); + if (LookupScope *delegate = _currentLookupScope->lookupType(q)) { + LookupScope *b = _currentLookupScope->d->findOrCreateType(unqualifiedId); b->d->addUsing(delegate); } } @@ -1872,8 +1870,8 @@ bool CreateBindings::visit(UsingDeclaration *u) bool CreateBindings::visit(UsingNamespaceDirective *u) { - if (ClassOrNamespace *e = _currentClassOrNamespace->lookupType(u->name())) { - _currentClassOrNamespace->d->addUsing(e); + if (LookupScope *e = _currentLookupScope->lookupType(u->name())) { + _currentLookupScope->d->addUsing(e); } else if (false) { Overview oo; qDebug() << "no entity for namespace:" << oo.prettyName(u->name()); @@ -1886,9 +1884,9 @@ bool CreateBindings::visit(NamespaceAlias *a) if (! a->identifier()) { return false; - } else if (ClassOrNamespace *e = _currentClassOrNamespace->lookupType(a->namespaceName())) { + } else if (LookupScope *e = _currentLookupScope->lookupType(a->namespaceName())) { if (a->name()->isNameId() || a->name()->isTemplateNameId() || a->name()->isAnonymousNameId()) - _currentClassOrNamespace->d->addNestedType(a->name(), e); + _currentLookupScope->d->addNestedType(a->name(), e); } else if (false) { Overview oo; @@ -1900,7 +1898,7 @@ bool CreateBindings::visit(NamespaceAlias *a) bool CreateBindings::visit(ObjCClass *klass) { - ClassOrNamespace *previous = enterGlobalClassOrNamespace(klass); + LookupScope *previous = enterGlobalLookupScope(klass); process(klass->baseClass()); @@ -1910,14 +1908,14 @@ bool CreateBindings::visit(ObjCClass *klass) for (unsigned i = 0; i < klass->memberCount(); ++i) process(klass->memberAt(i)); - _currentClassOrNamespace = previous; + _currentLookupScope = previous; return false; } bool CreateBindings::visit(ObjCBaseClass *b) { - if (ClassOrNamespace *base = _globalNamespace->lookupType(b->name())) { - _currentClassOrNamespace->d->addUsing(base); + if (LookupScope *base = _globalNamespace->lookupType(b->name())) { + _currentLookupScope->d->addUsing(base); } else if (false) { Overview oo; qDebug() << "no entity for:" << oo.prettyName(b->name()); @@ -1927,14 +1925,14 @@ bool CreateBindings::visit(ObjCBaseClass *b) bool CreateBindings::visit(ObjCForwardClassDeclaration *klass) { - ClassOrNamespace *previous = enterGlobalClassOrNamespace(klass); - _currentClassOrNamespace = previous; + LookupScope *previous = enterGlobalLookupScope(klass); + _currentLookupScope = previous; return false; } bool CreateBindings::visit(ObjCProtocol *proto) { - ClassOrNamespace *previous = enterGlobalClassOrNamespace(proto); + LookupScope *previous = enterGlobalLookupScope(proto); for (unsigned i = 0; i < proto->protocolCount(); ++i) process(proto->protocolAt(i)); @@ -1942,14 +1940,14 @@ bool CreateBindings::visit(ObjCProtocol *proto) for (unsigned i = 0; i < proto->memberCount(); ++i) process(proto->memberAt(i)); - _currentClassOrNamespace = previous; + _currentLookupScope = previous; return false; } bool CreateBindings::visit(ObjCBaseProtocol *b) { - if (ClassOrNamespace *base = _globalNamespace->lookupType(b->name())) { - _currentClassOrNamespace->d->addUsing(base); + if (LookupScope *base = _globalNamespace->lookupType(b->name())) { + _currentLookupScope->d->addUsing(base); } else if (false) { Overview oo; qDebug() << "no entity for:" << oo.prettyName(b->name()); @@ -1959,8 +1957,8 @@ bool CreateBindings::visit(ObjCBaseProtocol *b) bool CreateBindings::visit(ObjCForwardProtocolDeclaration *proto) { - ClassOrNamespace *previous = enterGlobalClassOrNamespace(proto); - _currentClassOrNamespace = previous; + LookupScope *previous = enterGlobalLookupScope(proto); + _currentLookupScope = previous; return false; } diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h index bc3e6ba0fc..c129ffdcdc 100644 --- a/src/libs/cplusplus/LookupContext.h +++ b/src/libs/cplusplus/LookupContext.h @@ -58,43 +58,43 @@ struct FullyQualifiedName : fqn(fqn) {} }; -class ClassOrNamespacePrivate; +class LookupScopePrivate; class Instantiator; } // namespace Internal; class CreateBindings; -class CPLUSPLUS_EXPORT ClassOrNamespace +class CPLUSPLUS_EXPORT LookupScope { - Q_DISABLE_COPY(ClassOrNamespace) + Q_DISABLE_COPY(LookupScope) - ClassOrNamespace(CreateBindings *factory, ClassOrNamespace *parent); + LookupScope(CreateBindings *factory, LookupScope *parent); public: - ~ClassOrNamespace(); + ~LookupScope(); - ClassOrNamespace *instantiationOrigin() const; + LookupScope *instantiationOrigin() const; - ClassOrNamespace *parent() const; - QList<ClassOrNamespace *> usings() const; + LookupScope *parent() const; + QList<LookupScope *> usings() const; QList<Enum *> unscopedEnums() const; QList<Symbol *> symbols() const; QList<LookupItem> lookup(const Name *name); QList<LookupItem> find(const Name *name); - ClassOrNamespace *lookupType(const Name *name); - ClassOrNamespace *lookupType(const Name *name, Block *block); - ClassOrNamespace *findType(const Name *name); - ClassOrNamespace *findBlock(Block *block); + LookupScope *lookupType(const Name *name); + LookupScope *lookupType(const Name *name, Block *block); + LookupScope *findType(const Name *name); + LookupScope *findBlock(Block *block); - /// The class this ClassOrNamespace is based on. + /// The class this LookupScope is based on. Class *rootClass() const; private: - Internal::ClassOrNamespacePrivate *d; + Internal::LookupScopePrivate *d; - friend class Internal::ClassOrNamespacePrivate; + friend class Internal::LookupScopePrivate; friend class Internal::Instantiator; friend class CreateBindings; }; @@ -108,12 +108,11 @@ public: virtual ~CreateBindings(); /// Returns the binding for the global namespace. - ClassOrNamespace *globalNamespace() const; + LookupScope *globalNamespace() const; /// Finds the binding associated to the given symbol. - ClassOrNamespace *lookupType(Symbol *symbol, ClassOrNamespace *enclosingBinding = 0); - ClassOrNamespace *lookupType(const QList<const Name *> &path, - ClassOrNamespace *enclosingBinding = 0); + LookupScope *lookupType(Symbol *symbol, LookupScope *enclosingBinding = 0); + LookupScope *lookupType(const QList<const Name *> &path, LookupScope *enclosingBinding = 0); /// Returns the Control that must be used to create temporary symbols. /// \internal @@ -129,28 +128,28 @@ public: /// Store the result in \a results. /// \internal void lookupInScope(const Name *name, Scope *scope, QList<LookupItem> *result, - ClassOrNamespace *binding = 0); + LookupScope *binding = 0); /// Create bindings for the symbols reachable from \a rootSymbol. /// \internal - void process(Symbol *rootSymbol, ClassOrNamespace *classOrNamespace); + void process(Symbol *rootSymbol, LookupScope *lookupScope); - /// Create an empty ClassOrNamespace binding with the given \a parent. + /// Create an empty LookupScope binding with the given \a parent. /// \internal - ClassOrNamespace *allocClassOrNamespace(ClassOrNamespace *parent); + LookupScope *allocLookupScope(LookupScope *parent); protected: using SymbolVisitor::visit; - /// Change the current ClassOrNamespace binding. - ClassOrNamespace *switchCurrentClassOrNamespace(ClassOrNamespace *classOrNamespace); + /// Change the current LookupScope binding. + LookupScope *switchCurrentLookupScope(LookupScope *lookupScope); - /// Enters the ClassOrNamespace binding associated with the given \a symbol. - ClassOrNamespace *enterClassOrNamespaceBinding(Symbol *symbol); + /// Enters the LookupScope binding associated with the given \a symbol. + LookupScope *enterLookupScopeBinding(Symbol *symbol); - /// Enters a ClassOrNamespace binding for the given \a symbol in the global + /// Enters a LookupScope binding for the given \a symbol in the global /// namespace binding. - ClassOrNamespace *enterGlobalClassOrNamespace(Symbol *symbol); + LookupScope *enterGlobalLookupScope(Symbol *symbol); /// Creates bindings for the given \a document. void process(Document::Ptr document); @@ -187,9 +186,9 @@ private: Snapshot _snapshot; QSharedPointer<Control> _control; QSet<Namespace *> _processed; - QList<ClassOrNamespace *> _entities; - ClassOrNamespace *_globalNamespace; - ClassOrNamespace *_currentClassOrNamespace; + QList<LookupScope *> _entities; + LookupScope *_globalNamespace; + LookupScope *_currentLookupScope; bool _expandTemplates; }; @@ -214,16 +213,16 @@ public: Document::Ptr document(const QString &fileName) const; Snapshot snapshot() const; - ClassOrNamespace *globalNamespace() const; + LookupScope *globalNamespace() const; QList<LookupItem> lookup(const Name *name, Scope *scope) const; - ClassOrNamespace *lookupType(const Name *name, Scope *scope, - ClassOrNamespace *enclosingBinding = 0, + LookupScope *lookupType(const Name *name, Scope *scope, + LookupScope *enclosingBinding = 0, QSet<const Declaration *> typedefsBeingResolved = QSet<const Declaration *>()) const; - ClassOrNamespace *lookupType(Symbol *symbol, - ClassOrNamespace *enclosingBinding = 0) const; - ClassOrNamespace *lookupParent(Symbol *symbol) const; + LookupScope *lookupType(Symbol *symbol, + LookupScope *enclosingBinding = 0) const; + LookupScope *lookupParent(Symbol *symbol) const; /// \internal QSharedPointer<CreateBindings> bindings() const @@ -232,7 +231,7 @@ public: static QList<const Name *> fullyQualifiedName(Symbol *symbol); static QList<const Name *> path(Symbol *symbol); - static const Name *minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control); + static const Name *minimalName(Symbol *symbol, LookupScope *target, Control *control); void setExpandTemplates(bool expandTemplates) { @@ -242,7 +241,7 @@ public: } private: - QList<LookupItem> lookupByUsing(const Name *name, ClassOrNamespace *bindingScope) const; + QList<LookupItem> lookupByUsing(const Name *name, LookupScope *bindingScope) const; // The current expression. Document::Ptr _expressionDocument; diff --git a/src/libs/cplusplus/LookupItem.cpp b/src/libs/cplusplus/LookupItem.cpp index 0621c1f6e9..4e22389503 100644 --- a/src/libs/cplusplus/LookupItem.cpp +++ b/src/libs/cplusplus/LookupItem.cpp @@ -77,10 +77,10 @@ Scope *LookupItem::scope() const void LookupItem::setScope(Scope *scope) { _scope = scope; } -ClassOrNamespace *LookupItem::binding() const +LookupScope *LookupItem::binding() const { return _binding; } -void LookupItem::setBinding(ClassOrNamespace *binding) +void LookupItem::setBinding(LookupScope *binding) { _binding = binding; } bool LookupItem::operator == (const LookupItem &other) const diff --git a/src/libs/cplusplus/LookupItem.h b/src/libs/cplusplus/LookupItem.h index 46c7b34716..13963b7064 100644 --- a/src/libs/cplusplus/LookupItem.h +++ b/src/libs/cplusplus/LookupItem.h @@ -37,7 +37,7 @@ namespace CPlusPlus { -class ClassOrNamespace; +class LookupScope; class CPLUSPLUS_EXPORT LookupItem { @@ -63,8 +63,8 @@ public: /// Sets this item's scope. void setScope(Scope *scope); - ClassOrNamespace *binding() const; - void setBinding(ClassOrNamespace *binding); + LookupScope *binding() const; + void setBinding(LookupScope *binding); bool operator == (const LookupItem &other) const; bool operator != (const LookupItem &other) const; @@ -73,7 +73,7 @@ private: FullySpecifiedType _type; Scope *_scope; Symbol *_declaration; - ClassOrNamespace *_binding; + LookupScope *_binding; }; uint qHash(const CPlusPlus::LookupItem &result); diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp index d80036b74d..6a967691d0 100644 --- a/src/libs/cplusplus/ResolveExpression.cpp +++ b/src/libs/cplusplus/ResolveExpression.cpp @@ -176,7 +176,7 @@ void ResolveExpression::addResults(const QList<LookupItem> &items) } void ResolveExpression::addResult(const FullySpecifiedType &ty, Scope *scope, - ClassOrNamespace *binding) + LookupScope *binding) { LookupItem item; item.setType(ty); @@ -206,7 +206,7 @@ bool ResolveExpression::visit(BinaryExpressionAST *ast) if (d->core_declarator) { if (DeclaratorIdAST *declaratorId = d->core_declarator->asDeclaratorId()) { if (NameAST *nameAST = declaratorId->name) { - if (ClassOrNamespace *binding = baseExpression(_results, T_ARROW)) { + if (LookupScope *binding = baseExpression(_results, T_ARROW)) { _results.clear(); addResults(binding->lookup(nameAST->name)); } @@ -487,7 +487,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast) added = true; } else if (namedTy != 0) { const Name *starOp = control()->operatorNameId(OperatorNameId::StarOp); - if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), p.scope(), p.binding())) { + if (LookupScope *b = _context.lookupType(namedTy->name(), p.scope(), p.binding())) { foreach (const LookupItem &r, b->find(starOp)) { Symbol *overload = r.declaration(); if (Function *funTy = overload->type()->asFunctionType()) { @@ -746,7 +746,7 @@ bool ResolveExpression::visit(CallAST *ast) Scope *scope = result.scope(); if (NamedType *namedTy = ty->asNamedType()) { - if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), scope)) { + if (LookupScope *b = _context.lookupType(namedTy->name(), scope)) { foreach (const LookupItem &r, b->find(functionCallOp)) { Symbol *overload = r.declaration(); if (Function *funTy = overload->type()->asFunctionType()) { @@ -797,7 +797,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast) addResult(arrTy->elementType().simplified(), scope); } else if (NamedType *namedTy = ty->asNamedType()) { - if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), scope)) { + if (LookupScope *b = _context.lookupType(namedTy->name(), scope)) { foreach (const LookupItem &r, b->find(arrayAccessOp)) { Symbol *overload = r.declaration(); if (Function *funTy = overload->type()->asFunctionType()) { @@ -812,7 +812,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast) return false; } -QList<LookupItem> ResolveExpression::getMembers(ClassOrNamespace *binding, const Name *memberName) const +QList<LookupItem> ResolveExpression::getMembers(LookupScope *binding, const Name *memberName) const { Q_UNUSED(binding); Q_UNUSED(memberName); @@ -881,17 +881,17 @@ bool ResolveExpression::visit(MemberAccessAST *ast) // Remember the access operator. const int accessOp = tokenKind(ast->access_token); - if (ClassOrNamespace *binding = baseExpression(baseResults, accessOp)) + if (LookupScope *binding = baseExpression(baseResults, accessOp)) addResults(binding->find(memberName)); return false; } -ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &originalTy, Scope *scope, - ClassOrNamespace *enclosingBinding) const +LookupScope *ResolveExpression::findClass(const FullySpecifiedType &originalTy, Scope *scope, + LookupScope *enclosingBinding) const { FullySpecifiedType ty = originalTy.simplified(); - ClassOrNamespace *binding = 0; + LookupScope *binding = 0; if (Class *klass = ty->asClassType()) { if (scope->isBlock()) @@ -909,9 +909,9 @@ ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &origina return binding; } -ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &baseResults, - int accessOp, - bool *replacedDotOperator) const +LookupScope *ResolveExpression::baseExpression(const QList<LookupItem> &baseResults, + int accessOp, + bool *replacedDotOperator) const { if (Q_UNLIKELY(debug)) qDebug() << "In ResolveExpression::baseExpression with" << baseResults.size() << "results..."; @@ -934,16 +934,16 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas if (accessOp == T_ARROW) { if (PointerType *ptrTy = ty->asPointerType()) { FullySpecifiedType type = ptrTy->elementType(); - if (ClassOrNamespace *binding + if (LookupScope *binding = findClassForTemplateParameterInExpressionScope(r.binding(), type)) { return binding; } - if (ClassOrNamespace *binding = findClass(type, scope)) + if (LookupScope *binding = findClass(type, scope)) return binding; } else { - ClassOrNamespace *binding + LookupScope *binding = findClassForTemplateParameterInExpressionScope(r.binding(), ty); @@ -972,20 +972,20 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas if (PointerType *ptrTy = retTy->asPointerType()) retTy = ptrTy->elementType(); - if (ClassOrNamespace *retBinding = findClass(retTy, functionScope)) + if (LookupScope *retBinding = findClass(retTy, functionScope)) return retBinding; if (scope != functionScope) { - if (ClassOrNamespace *retBinding = findClass(retTy, scope)) + if (LookupScope *retBinding = findClass(retTy, scope)) return retBinding; } - if (ClassOrNamespace *origin = binding->instantiationOrigin()) { + if (LookupScope *origin = binding->instantiationOrigin()) { foreach (Symbol *originSymbol, origin->symbols()) { Scope *originScope = originSymbol->asScope(); if (originScope && originScope != scope && originScope != functionScope) { - if (ClassOrNamespace *retBinding + if (LookupScope *retBinding = findClass(retTy, originScope)) return retBinding; } @@ -1002,19 +1002,19 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas ty = ptrTy->elementType(); } - if (ClassOrNamespace *binding + if (LookupScope *binding = findClassForTemplateParameterInExpressionScope(r.binding(), ty)) { return binding; } - ClassOrNamespace *enclosingBinding = 0; - if (ClassOrNamespace *binding = r.binding()) { + LookupScope *enclosingBinding = 0; + if (LookupScope *binding = r.binding()) { if (binding->instantiationOrigin()) enclosingBinding = binding; } - if (ClassOrNamespace *binding = findClass(ty, scope, enclosingBinding)) + if (LookupScope *binding = findClass(ty, scope, enclosingBinding)) return binding; } } @@ -1022,15 +1022,15 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas return 0; } -ClassOrNamespace *ResolveExpression::findClassForTemplateParameterInExpressionScope( - ClassOrNamespace *resultBinding, +LookupScope *ResolveExpression::findClassForTemplateParameterInExpressionScope( + LookupScope *resultBinding, const FullySpecifiedType &ty) const { if (resultBinding) { - if (ClassOrNamespace *origin = resultBinding->instantiationOrigin()) { + if (LookupScope *origin = resultBinding->instantiationOrigin()) { foreach (Symbol *originSymbol, origin->symbols()) { if (Scope *originScope = originSymbol->asScope()) { - if (ClassOrNamespace *retBinding = findClass(ty, originScope)) + if (LookupScope *retBinding = findClass(ty, originScope)) return retBinding; } } @@ -1053,7 +1053,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast) foreach (const LookupItem &result, receiverResults) { FullySpecifiedType ty = result.type().simplified(); - ClassOrNamespace *binding = 0; + LookupScope *binding = 0; if (ObjCClass *clazz = ty->asObjCClassType()) { // static access, e.g.: diff --git a/src/libs/cplusplus/ResolveExpression.h b/src/libs/cplusplus/ResolveExpression.h index 1fa15ffded..df73ad5ef7 100644 --- a/src/libs/cplusplus/ResolveExpression.h +++ b/src/libs/cplusplus/ResolveExpression.h @@ -53,25 +53,25 @@ public: QList<LookupItem> resolve(ExpressionAST *ast, Scope *scope, bool ref = false); QList<LookupItem> reference(ExpressionAST *ast, Scope *scope); - ClassOrNamespace *baseExpression(const QList<LookupItem> &baseResults, + LookupScope *baseExpression(const QList<LookupItem> &baseResults, int accessOp, bool *replacedDotOperator = 0) const; const LookupContext &context() const; protected: - ClassOrNamespace *findClass(const FullySpecifiedType &ty, Scope *scope, - ClassOrNamespace *enclosingBinding = 0) const; + LookupScope *findClass(const FullySpecifiedType &ty, Scope *scope, + LookupScope *enclosingBinding = 0) const; QList<LookupItem> expression(ExpressionAST *ast); QList<LookupItem> switchResults(const QList<LookupItem> &symbols); - QList<LookupItem> getMembers(ClassOrNamespace *binding, const Name *memberName) const; + QList<LookupItem> getMembers(LookupScope *binding, const Name *memberName) const; void thisObject(); - void addResult(const FullySpecifiedType &ty, Scope *scope, ClassOrNamespace *binding = 0); + void addResult(const FullySpecifiedType &ty, Scope *scope, LookupScope *binding = 0); void addResults(const QList<Symbol *> &symbols); void addResults(const QList<LookupItem> &items); @@ -125,8 +125,8 @@ protected: private: - ClassOrNamespace *findClassForTemplateParameterInExpressionScope( - ClassOrNamespace *resultBinding, + LookupScope *findClassForTemplateParameterInExpressionScope( + LookupScope *resultBinding, const FullySpecifiedType &ty) const; Scope *_scope; diff --git a/src/libs/cplusplus/TypeResolver.cpp b/src/libs/cplusplus/TypeResolver.cpp index 80ae16f2ef..5e5249f2e1 100644 --- a/src/libs/cplusplus/TypeResolver.cpp +++ b/src/libs/cplusplus/TypeResolver.cpp @@ -37,7 +37,7 @@ static const bool debug = ! qgetenv("QTC_LOOKUPCONTEXT_DEBUG").isEmpty(); namespace CPlusPlus { -void TypeResolver::resolve(FullySpecifiedType *type, Scope **scope, ClassOrNamespace *binding) +void TypeResolver::resolve(FullySpecifiedType *type, Scope **scope, LookupScope *binding) { QSet<Symbol *> visited; _binding = binding; @@ -73,13 +73,13 @@ NamedType *TypeResolver::getNamedType(FullySpecifiedType &type) const } QList<LookupItem> TypeResolver::getNamedTypeItems(const Name *name, Scope *scope, - ClassOrNamespace *binding) const + LookupScope *binding) const { QList<LookupItem> namedTypeItems = typedefsFromScopeUpToFunctionScope(name, scope); if (namedTypeItems.isEmpty()) { if (binding) namedTypeItems = binding->lookup(name); - if (ClassOrNamespace *scopeCon = _context.lookupType(scope)) + if (LookupScope *scopeCon = _context.lookupType(scope)) namedTypeItems += scopeCon->lookup(name); } diff --git a/src/libs/cplusplus/TypeResolver.h b/src/libs/cplusplus/TypeResolver.h index 85f54ab54a..5aa33a54d8 100644 --- a/src/libs/cplusplus/TypeResolver.h +++ b/src/libs/cplusplus/TypeResolver.h @@ -39,13 +39,13 @@ class TypeResolver { public: TypeResolver(const LookupContext &context) : _context(context) {} - void resolve(FullySpecifiedType *type, Scope **scope, ClassOrNamespace *binding); + void resolve(FullySpecifiedType *type, Scope **scope, LookupScope *binding); private: NamedType *getNamedType(FullySpecifiedType& type) const; QList<LookupItem> getNamedTypeItems(const Name *name, Scope *scope, - ClassOrNamespace *binding) const; + LookupScope *binding) const; static QList<LookupItem> typedefsFromScopeUpToFunctionScope(const Name *name, Scope *scope); @@ -56,7 +56,7 @@ private: const LookupContext &_context; // binding has to be remembered in case of resolving typedefs for templates - ClassOrNamespace *_binding; + LookupScope *_binding; }; } // namespace CPlusPlus diff --git a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp index cf1dde0819..f7edb410d2 100644 --- a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp +++ b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp @@ -795,7 +795,7 @@ static void buildContextProperties( Scope *typeScope = result.scope(); if (!typeScope) typeScope = scope; // incorrect but may be an ok fallback - ClassOrNamespace *binding = typeOf.context().lookupType(namedType->name(), typeScope); + LookupScope *binding = typeOf.context().lookupType(namedType->name(), typeScope); if (binding && !binding->symbols().isEmpty()) { // find the best 'Class' symbol for (int i = binding->symbols().size() - 1; i >= 0; --i) { diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 460d8b7c3a..c01958baa4 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -389,7 +389,7 @@ void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit) } else if (functionDefinitionSymbol) { const Snapshot snapshot = d->m_modelManager->snapshot(); LookupContext context(d->m_lastSemanticInfo.doc, snapshot); - ClassOrNamespace *binding = context.lookupType(functionDefinitionSymbol); + LookupScope *binding = context.lookupType(functionDefinitionSymbol); const QList<LookupItem> declarations = context.lookup(functionDefinitionSymbol->name(), functionDefinitionSymbol->enclosingScope()); diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index fa85a8eb05..119ab2d69b 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -327,10 +327,10 @@ bool CppClass::operator==(const CppClass &other) void CppClass::lookupBases(Symbol *declaration, const LookupContext &context) { - typedef QPair<ClassOrNamespace *, CppClass *> Data; + typedef QPair<LookupScope *, CppClass *> Data; - if (ClassOrNamespace *clazz = context.lookupType(declaration)) { - QSet<ClassOrNamespace *> visited; + if (LookupScope *clazz = context.lookupType(declaration)) { + QSet<LookupScope *> visited; QQueue<Data> q; q.enqueue(qMakePair(clazz, this)); @@ -338,8 +338,8 @@ void CppClass::lookupBases(Symbol *declaration, const LookupContext &context) Data current = q.dequeue(); clazz = current.first; visited.insert(clazz); - const QList<ClassOrNamespace *> &bases = clazz->usings(); - foreach (ClassOrNamespace *baseClass, bases) { + const QList<LookupScope *> &bases = clazz->usings(); + foreach (LookupScope *baseClass, bases) { const QList<Symbol *> &symbols = baseClass->symbols(); foreach (Symbol *symbol, symbols) { if (symbol->isClass() && ( @@ -429,7 +429,7 @@ CppVariable::CppVariable(Symbol *declaration, const LookupContext &context, Scop } if (typeName) { - if (ClassOrNamespace *clazz = context.lookupType(typeName, scope)) { + if (LookupScope *clazz = context.lookupType(typeName, scope)) { if (!clazz->symbols().isEmpty()) { Overview overview; Symbol *symbol = clazz->symbols().at(0); diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp index 92498eef9a..ed7beafbab 100644 --- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp +++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp @@ -187,7 +187,7 @@ Class *VirtualFunctionHelper::staticClassOfFunctionCallExpression_internal() con const QList<LookupItem> items = typeOfExpression(memberAccessAST->base_expression, m_expressionDocument, m_scope); ResolveExpression resolveExpression(typeOfExpression.context()); - ClassOrNamespace *binding = resolveExpression.baseExpression(items, m_accessTokenKind); + LookupScope *binding = resolveExpression.baseExpression(items, m_accessTokenKind); if (binding) { if (Class *klass = binding->rootClass()) { result = klass; diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index 4c359ed9b6..dfb0b1018a 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -607,7 +607,7 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse SubstitutionEnvironment env; env.setContext(sourceContext); env.switchScope(sourceFunction->enclosingScope()); - ClassOrNamespace *targetCoN = targetContext.lookupType(targetFunction->enclosingScope()); + LookupScope *targetCoN = targetContext.lookupType(targetFunction->enclosingScope()); if (!targetCoN) targetCoN = targetContext.globalNamespace(); UseMinimalNames q(targetCoN); @@ -653,7 +653,7 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse SubstitutionEnvironment env; env.setContext(sourceContext); env.switchScope(sourceFunction); - ClassOrNamespace *targetCoN = targetContext.lookupType(targetFunction); + LookupScope *targetCoN = targetContext.lookupType(targetFunction); if (!targetCoN) targetCoN = targetContext.globalNamespace(); UseMinimalNames q(targetCoN); diff --git a/src/plugins/cppeditor/cppinsertvirtualmethods.cpp b/src/plugins/cppeditor/cppinsertvirtualmethods.cpp index 1564bc0da2..bd4c8c83fd 100644 --- a/src/plugins/cppeditor/cppinsertvirtualmethods.cpp +++ b/src/plugins/cppeditor/cppinsertvirtualmethods.cpp @@ -480,15 +480,15 @@ public: // Determine base classes QList<const Class *> baseClasses; - QQueue<ClassOrNamespace *> baseClassQueue; - QSet<ClassOrNamespace *> visitedBaseClasses; - if (ClassOrNamespace *clazz = interface.context().lookupType(m_classAST->symbol)) + QQueue<LookupScope *> baseClassQueue; + QSet<LookupScope *> visitedBaseClasses; + if (LookupScope *clazz = interface.context().lookupType(m_classAST->symbol)) baseClassQueue.enqueue(clazz); while (!baseClassQueue.isEmpty()) { - ClassOrNamespace *clazz = baseClassQueue.dequeue(); + LookupScope *clazz = baseClassQueue.dequeue(); visitedBaseClasses.insert(clazz); - const QList<ClassOrNamespace *> bases = clazz->usings(); - foreach (ClassOrNamespace *baseClass, bases) { + const QList<LookupScope *> bases = clazz->usings(); + foreach (LookupScope *baseClass, bases) { foreach (Symbol *symbol, baseClass->symbols()) { Class *base = symbol->asClass(); if (base @@ -690,7 +690,7 @@ public: const LookupContext targetContext(headerFile->cppDocument(), snapshot()); const Class *targetClass = m_classAST->symbol; - ClassOrNamespace *targetCoN = targetContext.lookupType(targetClass->enclosingScope()); + LookupScope *targetCoN = targetContext.lookupType(targetClass->enclosingScope()); if (!targetCoN) targetCoN = targetContext.globalNamespace(); UseMinimalNames useMinimalNames(targetCoN); @@ -778,7 +778,7 @@ public: implementationDoc->translationUnit()->getPosition(insertPos, &line, &column); Scope *targetScope = implementationDoc->scopeAt(line, column); const LookupContext targetContext(implementationDoc, snapshot()); - ClassOrNamespace *targetCoN = targetContext.lookupType(targetScope); + LookupScope *targetCoN = targetContext.lookupType(targetScope); if (!targetCoN) targetCoN = targetContext.globalNamespace(); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 123acefb22..3c5ab5a2b9 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -211,7 +211,7 @@ Class *isMemberFunction(const LookupContext &context, Function *function) if (!q->base()) return 0; - if (ClassOrNamespace *binding = context.lookupType(q->base(), enclosingScope)) { + if (LookupScope *binding = context.lookupType(q->base(), enclosingScope)) { foreach (Symbol *s, binding->symbols()) { if (Class *matchingClass = s->asClass()) return matchingClass; @@ -249,7 +249,7 @@ Namespace *isNamespaceFunction(const LookupContext &context, Function *function) if (!q->base()) return 0; - if (ClassOrNamespace *binding = context.lookupType(q->base(), enclosingScope)) { + if (LookupScope *binding = context.lookupType(q->base(), enclosingScope)) { foreach (Symbol *s, binding->symbols()) { if (Namespace *matchingNamespace = s->asNamespace()) return matchingNamespace; @@ -1323,7 +1323,7 @@ void TranslateStringLiteral::match(const CppQuickFixInterface &interface, for (int i = path.size() - 1; i >= 0; --i) { if (FunctionDefinitionAST *definition = path.at(i)->asFunctionDefinition()) { Function *function = definition->symbol; - ClassOrNamespace *b = interface.context().lookupType(function); + LookupScope *b = interface.context().lookupType(function); if (b) { // Do we have a tr function? foreach (const LookupItem &r, b->find(trName)) { @@ -1584,7 +1584,7 @@ public: SubstitutionEnvironment env; env.setContext(context()); env.switchScope(result.first().scope()); - ClassOrNamespace *con = typeOfExpression.context().lookupType(scope); + LookupScope *con = typeOfExpression.context().lookupType(scope); if (!con) con = typeOfExpression.context().globalNamespace(); UseMinimalNames q(con); @@ -2274,7 +2274,7 @@ Enum *findEnum(const QList<LookupItem> &results, const LookupContext &ctxt) if (Enum *e = type->asEnumType()) return e; if (const NamedType *namedType = type->asNamedType()) { - if (ClassOrNamespace *con = ctxt.lookupType(namedType->name(), result.scope())) { + if (LookupScope *con = ctxt.lookupType(namedType->name(), result.scope())) { const QList<Enum *> enums = con->unscopedEnums(); const Name *referenceName = namedType->name(); if (const QualifiedNameId *qualifiedName = referenceName->asQualifiedNameId()) @@ -2571,7 +2571,7 @@ public: Document::Ptr targetDoc = targetFile->cppDocument(); Scope *targetScope = targetDoc->scopeAt(m_loc.line(), m_loc.column()); LookupContext targetContext(targetDoc, snapshot()); - ClassOrNamespace *targetCoN = targetContext.lookupType(targetScope); + LookupScope *targetCoN = targetContext.lookupType(targetScope); if (!targetCoN) targetCoN = targetContext.globalNamespace(); @@ -3173,7 +3173,7 @@ public: SubstitutionEnvironment env; env.setContext(context()); env.switchScope(refFunc); - ClassOrNamespace *targetCoN = context().lookupType(refFunc->enclosingScope()); + LookupScope *targetCoN = context().lookupType(refFunc->enclosingScope()); if (!targetCoN) targetCoN = context().globalNamespace(); UseMinimalNames subs(targetCoN); @@ -4574,7 +4574,7 @@ QString definitionSignature(const CppQuickFixInterface *assist, QTC_ASSERT(func, return QString()); LookupContext cppContext(targetFile->cppDocument(), assist->snapshot()); - ClassOrNamespace *cppCoN = cppContext.lookupType(scope); + LookupScope *cppCoN = cppContext.lookupType(scope); if (!cppCoN) cppCoN = cppContext.globalNamespace(); SubstitutionEnvironment env; @@ -5055,7 +5055,7 @@ public: SubstitutionEnvironment env; env.setContext(context()); env.switchScope(result.first().scope()); - ClassOrNamespace *con = typeOfExpression.context().lookupType(scope); + LookupScope *con = typeOfExpression.context().lookupType(scope); if (!con) con = typeOfExpression.context().globalNamespace(); UseMinimalNames q(con); @@ -5654,7 +5654,7 @@ PointerType *determineConvertedType(NamedType *namedType, const LookupContext &c { if (!namedType) return 0; - if (ClassOrNamespace *binding = context.lookupType(namedType->name(), scope)) { + if (LookupScope *binding = context.lookupType(namedType->name(), scope)) { if (Symbol *objectClassSymbol = skipForwardDeclarations(binding->symbols())) { if (Class *klass = objectClassSymbol->asClass()) { for (auto it = klass->memberBegin(), end = klass->memberEnd(); it != end; ++it) { @@ -5712,7 +5712,7 @@ Class *senderOrReceiverClass(const CppQuickFixInterface &interface, NamedType *objectType = objectTypeBase->asNamedType(); QTC_ASSERT(objectType, return 0); - ClassOrNamespace *objectClassCON = context.lookupType(objectType->name(), objectPointerScope); + LookupScope *objectClassCON = context.lookupType(objectType->name(), objectPointerScope); QTC_ASSERT(objectClassCON, return 0); QTC_ASSERT(!objectClassCON->symbols().isEmpty(), return 0); @@ -5764,7 +5764,7 @@ bool findConnectReplacement(const CppQuickFixInterface &interface, // Minimize qualification Control *control = context.bindings()->control().data(); - ClassOrNamespace *functionCON = context.lookupParent(scope); + LookupScope *functionCON = context.lookupParent(scope); const Name *shortName = LookupContext::minimalName(method, functionCON, control); if (!shortName->asQualifiedNameId()) shortName = control->qualifiedNameId(classOfMethod->name(), shortName); diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index d7bee2281d..5ba8864b18 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -673,7 +673,7 @@ bool CheckSymbols::visit(NewExpressionAST *ast) if (highlightCtorDtorAsType) { accept(ast->new_type_id); } else { - ClassOrNamespace *binding = 0; + LookupScope *binding = 0; NameAST *nameAST = 0; if (ast->new_type_id) { for (SpecifierListAST *it = ast->new_type_id->type_specifier_list; it; it = it->next) { @@ -739,7 +739,7 @@ void CheckSymbols::checkNamespace(NameAST *name) unsigned line, column; getTokenStartPosition(name->firstToken(), &line, &column); - if (ClassOrNamespace *b = _context.lookupType(name->name, enclosingScope())) { + if (LookupScope *b = _context.lookupType(name->name, enclosingScope())) { foreach (Symbol *s, b->symbols()) { if (s->isNamespace()) return; @@ -772,14 +772,14 @@ bool CheckSymbols::hasVirtualDestructor(Class *klass) const return false; } -bool CheckSymbols::hasVirtualDestructor(ClassOrNamespace *binding) const +bool CheckSymbols::hasVirtualDestructor(LookupScope *binding) const { - QSet<ClassOrNamespace *> processed; - QList<ClassOrNamespace *> todo; + QSet<LookupScope *> processed; + QList<LookupScope *> todo; todo.append(binding); while (!todo.isEmpty()) { - ClassOrNamespace *b = todo.takeFirst(); + LookupScope *b = todo.takeFirst(); if (b && !processed.contains(b)) { processed.insert(b); foreach (Symbol *s, b->symbols()) { @@ -861,7 +861,7 @@ bool CheckSymbols::visit(QualifiedNameAST *ast) { if (ast->name) { - ClassOrNamespace *binding = checkNestedName(ast); + LookupScope *binding = checkNestedName(ast); if (binding && ast->unqualified_name) { if (ast->unqualified_name->asDestructorName() != 0) { @@ -890,9 +890,9 @@ bool CheckSymbols::visit(QualifiedNameAST *ast) return false; } -ClassOrNamespace *CheckSymbols::checkNestedName(QualifiedNameAST *ast) +LookupScope *CheckSymbols::checkNestedName(QualifiedNameAST *ast) { - ClassOrNamespace *binding = 0; + LookupScope *binding = 0; if (ast->name) { if (NestedNameSpecifierListAST *it = ast->nested_name_specifier_list) { @@ -958,7 +958,7 @@ bool CheckSymbols::visit(MemInitializerAST *ast) { if (FunctionDefinitionAST *enclosingFunction = enclosingFunctionDefinition()) { if (ast->name && enclosingFunction->symbol) { - if (ClassOrNamespace *binding = _context.lookupType(enclosingFunction->symbol)) { + if (LookupScope *binding = _context.lookupType(enclosingFunction->symbol)) { foreach (Symbol *s, binding->symbols()) { if (Class *klass = s->asClass()) { NameAST *nameAST = ast->name; @@ -1161,7 +1161,7 @@ void CheckSymbols::addUse(const Result &use) _usages.append(use); } -void CheckSymbols::addType(ClassOrNamespace *b, NameAST *ast) +void CheckSymbols::addType(LookupScope *b, NameAST *ast) { unsigned startToken; if (!b || !acceptName(ast, &startToken)) diff --git a/src/plugins/cpptools/cppchecksymbols.h b/src/plugins/cpptools/cppchecksymbols.h index f874c16323..11cde21146 100644 --- a/src/plugins/cpptools/cppchecksymbols.h +++ b/src/plugins/cpptools/cppchecksymbols.h @@ -105,7 +105,7 @@ protected: const QList<Result> &otherUses); bool hasVirtualDestructor(CPlusPlus::Class *klass) const; - bool hasVirtualDestructor(CPlusPlus::ClassOrNamespace *binding) const; + bool hasVirtualDestructor(CPlusPlus::LookupScope *binding) const; bool warning(unsigned line, unsigned column, const QString &text, unsigned length = 0); bool warning(CPlusPlus::AST *ast, const QString &text); @@ -119,13 +119,13 @@ protected: void checkNamespace(CPlusPlus::NameAST *name); void checkName(CPlusPlus::NameAST *ast, CPlusPlus::Scope *scope = 0); - CPlusPlus::ClassOrNamespace *checkNestedName(CPlusPlus::QualifiedNameAST *ast); + CPlusPlus::LookupScope *checkNestedName(CPlusPlus::QualifiedNameAST *ast); void addUse(const Result &use); void addUse(unsigned tokenIndex, Kind kind); void addUse(CPlusPlus::NameAST *name, Kind kind); - void addType(CPlusPlus::ClassOrNamespace *b, CPlusPlus::NameAST *ast); + void addType(CPlusPlus::LookupScope *b, CPlusPlus::NameAST *ast); bool maybeAddTypeOrStatic(const QList<CPlusPlus::LookupItem> &candidates, CPlusPlus::NameAST *ast); diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index 8811ae5132..2ef8299843 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -746,8 +746,8 @@ bool canCompleteClassNameAt2ndOr4thConnectArgument( || eater.eatConnectOpenParenthesisExpressionCommaAmpersandExpressionComma(); } -ClassOrNamespace *classOrNamespaceFromLookupItem(const LookupItem &lookupItem, - const LookupContext &context) +LookupScope *lookupScopeFromLookupItem(const LookupItem &lookupItem, + const LookupContext &context) { const Name *name = 0; @@ -776,7 +776,7 @@ ClassOrNamespace *classOrNamespaceFromLookupItem(const LookupItem &lookupItem, Class *classFromLookupItem(const LookupItem &lookupItem, const LookupContext &context) { - ClassOrNamespace *b = classOrNamespaceFromLookupItem(lookupItem, context); + LookupScope *b = lookupScopeFromLookupItem(lookupItem, context); if (!b) return 0; @@ -789,7 +789,7 @@ Class *classFromLookupItem(const LookupItem &lookupItem, const LookupContext &co const Name *minimalName(Symbol *symbol, Scope *targetScope, const LookupContext &context) { - ClassOrNamespace *target = context.lookupType(targetScope); + LookupScope *target = context.lookupType(targetScope); if (!target) target = context.globalNamespace(); return context.minimalName(symbol, target, context.bindings()->control().data()); @@ -1211,12 +1211,12 @@ bool InternalCppCompletionAssistProcessor::tryObjCCompletion() ty = ty->asPointerType()->elementType().simplified(); if (NamedType *namedTy = ty->asNamedType()) { - ClassOrNamespace *binding = lookupContext.lookupType(namedTy->name(), item.scope()); + LookupScope *binding = lookupContext.lookupType(namedTy->name(), item.scope()); completeObjCMsgSend(binding, false); } } else { if (ObjCClass *clazz = ty->asObjCClassType()) { - ClassOrNamespace *binding = lookupContext.lookupType(clazz->name(), item.scope()); + LookupScope *binding = lookupContext.lookupType(clazz->name(), item.scope()); completeObjCMsgSend(binding, true); } } @@ -1265,7 +1265,7 @@ void InternalCppCompletionAssistProcessor::addCompletionItem(Symbol *symbol, int } } -void InternalCppCompletionAssistProcessor::completeObjCMsgSend(ClassOrNamespace *binding, +void InternalCppCompletionAssistProcessor::completeObjCMsgSend(LookupScope *binding, bool staticClassAccess) { QList<Scope*> memberScopes; @@ -1534,26 +1534,26 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope) return !m_completions.isEmpty(); } - QList<ClassOrNamespace *> usingBindings; - ClassOrNamespace *currentBinding = 0; + QList<LookupScope *> usingBindings; + LookupScope *currentBinding = 0; for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) { if (Block *block = scope->asBlock()) { - if (ClassOrNamespace *binding = context.lookupType(scope)) { + if (LookupScope *binding = context.lookupType(scope)) { for (unsigned i = 0; i < scope->memberCount(); ++i) { Symbol *member = scope->memberAt(i); if (member->isEnum()) { - if (ClassOrNamespace *b = binding->findBlock(block)) + if (LookupScope *b = binding->findBlock(block)) completeNamespace(b); } if (!member->name()) continue; if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) { - if (ClassOrNamespace *b = binding->lookupType(u->name())) + if (LookupScope *b = binding->lookupType(u->name())) usingBindings.append(b); } else if (Class *c = member->asClass()) { if (c->name()->isAnonymousNameId()) { - if (ClassOrNamespace *b = binding->findBlock(block)) + if (LookupScope *b = binding->findBlock(block)) completeClass(b); } } @@ -1580,7 +1580,7 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope) } for (; currentBinding; currentBinding = currentBinding->parent()) { - foreach (ClassOrNamespace* u, currentBinding->usings()) + foreach (LookupScope* u, currentBinding->usings()) usingBindings.append(u); const QList<Symbol *> symbols = currentBinding->symbols(); @@ -1593,7 +1593,7 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope) } } - foreach (ClassOrNamespace *b, usingBindings) + foreach (LookupScope *b, usingBindings) completeNamespace(b); addKeywords(); @@ -1616,7 +1616,7 @@ bool InternalCppCompletionAssistProcessor::completeMember(const QList<LookupItem if (!m_interface->languageFeatures().objCEnabled) replaceDotForArrow = &m_model->m_replaceDotForArrow; - if (ClassOrNamespace *binding = + if (LookupScope *binding = resolveExpression.baseExpression(baseResults, m_model->m_completionOperator, replaceDotForArrow)) { @@ -1640,27 +1640,27 @@ bool InternalCppCompletionAssistProcessor::completeScope(const QList<LookupItem> Scope *scope = result.scope(); if (NamedType *namedTy = ty->asNamedType()) { - if (ClassOrNamespace *b = context.lookupType(namedTy->name(), scope)) { + if (LookupScope *b = context.lookupType(namedTy->name(), scope)) { completeClass(b); break; } } else if (Class *classTy = ty->asClassType()) { - if (ClassOrNamespace *b = context.lookupType(classTy)) { + if (LookupScope *b = context.lookupType(classTy)) { completeClass(b); break; } // it can be class defined inside a block if (classTy->enclosingScope()->isBlock()) { - if (ClassOrNamespace *b = context.lookupType(classTy->name(), classTy->enclosingScope())) { + if (LookupScope *b = context.lookupType(classTy->name(), classTy->enclosingScope())) { completeClass(b); break; } } } else if (Namespace *nsTy = ty->asNamespaceType()) { - if (ClassOrNamespace *b = context.lookupType(nsTy)) { + if (LookupScope *b = context.lookupType(nsTy)) { completeNamespace(b); break; } @@ -1668,7 +1668,7 @@ bool InternalCppCompletionAssistProcessor::completeScope(const QList<LookupItem> } else if (Template *templ = ty->asTemplateType()) { if (!result.binding()) continue; - if (ClassOrNamespace *b = result.binding()->lookupType(templ->name())) { + if (LookupScope *b = result.binding()->lookupType(templ->name())) { completeClass(b); break; } @@ -1676,16 +1676,16 @@ bool InternalCppCompletionAssistProcessor::completeScope(const QList<LookupItem> } else if (Enum *e = ty->asEnumType()) { // it can be class defined inside a block if (e->enclosingScope()->isBlock()) { - if (ClassOrNamespace *b = context.lookupType(e)) { + if (LookupScope *b = context.lookupType(e)) { Block *block = e->enclosingScope()->asBlock(); - if (ClassOrNamespace *bb = b->findBlock(block)) { + if (LookupScope *bb = b->findBlock(block)) { completeNamespace(bb); break; } } } - if (ClassOrNamespace *b = context.lookupType(e)) { + if (LookupScope *b = context.lookupType(e)) { completeNamespace(b); break; } @@ -1696,14 +1696,14 @@ bool InternalCppCompletionAssistProcessor::completeScope(const QList<LookupItem> return !m_completions.isEmpty(); } -void InternalCppCompletionAssistProcessor::completeNamespace(ClassOrNamespace *b) +void InternalCppCompletionAssistProcessor::completeNamespace(LookupScope *b) { - QSet<ClassOrNamespace *> bindingsVisited; - QList<ClassOrNamespace *> bindingsToVisit; + QSet<LookupScope *> bindingsVisited; + QList<LookupScope *> bindingsToVisit; bindingsToVisit.append(b); while (!bindingsToVisit.isEmpty()) { - ClassOrNamespace *binding = bindingsToVisit.takeFirst(); + LookupScope *binding = bindingsToVisit.takeFirst(); if (!binding || bindingsVisited.contains(binding)) continue; @@ -1736,14 +1736,14 @@ void InternalCppCompletionAssistProcessor::completeNamespace(ClassOrNamespace *b } } -void InternalCppCompletionAssistProcessor::completeClass(ClassOrNamespace *b, bool staticLookup) +void InternalCppCompletionAssistProcessor::completeClass(LookupScope *b, bool staticLookup) { - QSet<ClassOrNamespace *> bindingsVisited; - QList<ClassOrNamespace *> bindingsToVisit; + QSet<LookupScope *> bindingsVisited; + QList<LookupScope *> bindingsToVisit; bindingsToVisit.append(b); while (!bindingsToVisit.isEmpty()) { - ClassOrNamespace *binding = bindingsToVisit.takeFirst(); + LookupScope *binding = bindingsToVisit.takeFirst(); if (!binding || bindingsVisited.contains(binding)) continue; @@ -1830,16 +1830,16 @@ bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupIt QSet<QString> signatures; foreach (const LookupItem &lookupItem, results) { - ClassOrNamespace *b = classOrNamespaceFromLookupItem(lookupItem, context); + LookupScope *b = lookupScopeFromLookupItem(lookupItem, context); if (!b) continue; - QList<ClassOrNamespace *>todo; - QSet<ClassOrNamespace *> processed; + QList<LookupScope *>todo; + QSet<LookupScope *> processed; QList<Scope *> scopes; todo.append(b); while (!todo.isEmpty()) { - ClassOrNamespace *binding = todo.takeLast(); + LookupScope *binding = todo.takeLast(); if (!processed.contains(binding)) { processed.insert(binding); @@ -2048,7 +2048,7 @@ bool InternalCppCompletionAssistProcessor::completeConstructorOrFunction(const Q Scope *scope = result.scope(); if (NamedType *namedTy = ty->asNamedType()) { - if (ClassOrNamespace *b = context.lookupType(namedTy->name(), scope)) { + if (LookupScope *b = context.lookupType(namedTy->name(), scope)) { foreach (const LookupItem &r, b->lookup(functionCallOp)) { Symbol *overload = r.declaration(); FullySpecifiedType overloadTy = overload->type().simplified(); @@ -2130,7 +2130,7 @@ bool InternalCppCompletionAssistProcessor::completeConstructorOrFunction(const Q SubstitutionEnvironment env; env.setContext(context); env.switchScope(sc); - ClassOrNamespace *targetCoN = context.lookupType(sc); + LookupScope *targetCoN = context.lookupType(sc); if (!targetCoN) targetCoN = context.globalNamespace(); UseMinimalNames q(targetCoN); diff --git a/src/plugins/cpptools/cppcompletionassist.h b/src/plugins/cpptools/cppcompletionassist.h index 585d66eb0c..beea43dc23 100644 --- a/src/plugins/cpptools/cppcompletionassist.h +++ b/src/plugins/cpptools/cppcompletionassist.h @@ -52,7 +52,7 @@ namespace CPlusPlus { class LookupItem; -class ClassOrNamespace; +class LookupScope; class Function; class LookupContext; } // namespace CPlusPlus @@ -120,7 +120,7 @@ private: const QString &expression, int endOfExpression); - void completeObjCMsgSend(CPlusPlus::ClassOrNamespace *binding, bool staticClassAccess); + void completeObjCMsgSend(CPlusPlus::LookupScope *binding, bool staticClassAccess); bool completeInclude(const QTextCursor &cursor); void completeInclude(const QString &realPath, const QStringList &suffixes); void completePreprocessor(); @@ -129,8 +129,8 @@ private: bool toolTipOnly); bool completeMember(const QList<CPlusPlus::LookupItem> &results); bool completeScope(const QList<CPlusPlus::LookupItem> &results); - void completeNamespace(CPlusPlus::ClassOrNamespace *binding); - void completeClass(CPlusPlus::ClassOrNamespace *b, bool staticLookup = true); + void completeNamespace(CPlusPlus::LookupScope *binding); + void completeClass(CPlusPlus::LookupScope *b, bool staticLookup = true); void addClassMembersToCompletion(CPlusPlus::Scope *scope, bool staticLookup); enum CompleteQtMethodMode { CompleteQt4Signals, diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index 77d2ade298..44fa431931 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -104,7 +104,7 @@ bool isOwnershipRAIIType(Symbol *symbol, const LookupContext &context) Declaration *declaration = symbol->asDeclaration(); const NamedType *namedType = declaration->type()->asNamedType(); if (namedType) { - ClassOrNamespace *clazz = context.lookupType(namedType->name(), + LookupScope *clazz = context.lookupType(namedType->name(), declaration->enclosingScope()); if (clazz && !clazz->symbols().isEmpty()) { Overview overview; diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index d307a0c07d..52bad5ab25 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -149,7 +149,7 @@ Function *SymbolFinder::findMatchingDefinition(Symbol *declaration, QList<Function *> viableFunctions; - ClassOrNamespace *enclosingType = context.lookupType(declaration); + LookupScope *enclosingType = context.lookupType(declaration); if (!enclosingType) continue; // nothing to do @@ -232,7 +232,7 @@ Class *SymbolFinder::findMatchingClassDeclaration(Symbol *declaration, const Sna LookupContext context(doc, snapshot); - ClassOrNamespace *type = context.lookupType(declaration); + LookupScope *type = context.lookupType(declaration); if (!type) continue; @@ -281,7 +281,7 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context, if (!functionName) return; - ClassOrNamespace *binding = 0; + LookupScope *binding = 0; const QualifiedNameId *qName = functionName->asQualifiedNameId(); if (qName) { if (qName->base()) diff --git a/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp b/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp index 3b7e4c52d0..5c2be00058 100644 --- a/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp +++ b/src/tools/cplusplus-mkvisitor/cplusplus-mkvisitor.cpp @@ -65,12 +65,12 @@ class MkVisitor: protected SymbolVisitor { const LookupContext &context; Overview oo; - QList<ClassOrNamespace *> interfaces; - QList<ClassOrNamespace *> nodes; + QList<LookupScope *> interfaces; + QList<LookupScope *> nodes; - bool isMiscNode(ClassOrNamespace *b) const + bool isMiscNode(LookupScope *b) const { - foreach (ClassOrNamespace *u, b->usings()) { + foreach (LookupScope *u, b->usings()) { if (oo(u->symbols().first()->name()) == QLatin1String("AST")) return true; } @@ -78,7 +78,7 @@ class MkVisitor: protected SymbolVisitor return false; } - QString getAcceptFunctionName(ClassOrNamespace *b, QString *retType) const + QString getAcceptFunctionName(LookupScope *b, QString *retType) const { Q_ASSERT(b != 0); @@ -131,7 +131,7 @@ public: << " Semantic(TranslationUnit *unit): ASTVisitor(unit) { translationUnit(unit->ast()->asTranslationUnit()); }" << std::endl << std::endl; - foreach (ClassOrNamespace *b, interfaces) { + foreach (LookupScope *b, interfaces) { Q_ASSERT(! b->symbols().isEmpty()); Class *klass = 0; @@ -162,10 +162,10 @@ public: std::cout << " using ASTVisitor::translationUnit;" << std::endl << std::endl; - QHash<ClassOrNamespace *, QList<ClassOrNamespace *> > implements; - foreach (ClassOrNamespace *b, nodes) { - ClassOrNamespace *iface = 0; - foreach (ClassOrNamespace *u, b->usings()) { + QHash<LookupScope *, QList<LookupScope *> > implements; + foreach (LookupScope *b, nodes) { + LookupScope *iface = 0; + foreach (LookupScope *u, b->usings()) { if (interfaces.contains(u)) { iface = u; break; @@ -175,8 +175,8 @@ public: implements[iface].append(b); } - foreach (ClassOrNamespace *iface, interfaces) { - foreach (ClassOrNamespace *b, implements.value(iface)) { + foreach (LookupScope *iface, interfaces) { + foreach (LookupScope *b, implements.value(iface)) { if (! isMiscNode(b)) continue; @@ -195,9 +195,9 @@ public: std::cout << std::endl; - foreach (ClassOrNamespace *iface, interfaces) { + foreach (LookupScope *iface, interfaces) { std::cout << " // " << qPrintable(oo(iface->symbols().first()->name())) << std::endl; - foreach (ClassOrNamespace *b, implements.value(iface)) { + foreach (LookupScope *b, implements.value(iface)) { Class *klass = 0; foreach (Symbol *s, b->symbols()) if ((klass = s->asClass()) != 0) @@ -212,7 +212,7 @@ public: } std::cout << "private:" << std::endl; - foreach (ClassOrNamespace *b, interfaces) { + foreach (LookupScope *b, interfaces) { Q_ASSERT(! b->symbols().isEmpty()); Class *klass = 0; @@ -245,7 +245,7 @@ public: // implementation - foreach (ClassOrNamespace *b, interfaces) { + foreach (LookupScope *b, interfaces) { Q_ASSERT(! b->symbols().isEmpty()); Class *klass = 0; @@ -280,9 +280,9 @@ public: << std::endl; } - foreach (ClassOrNamespace *iface, interfaces) { + foreach (LookupScope *iface, interfaces) { std::cout << "// " << qPrintable(oo(iface->symbols().first()->name())) << std::endl; - foreach (ClassOrNamespace *b, implements.value(iface)) { + foreach (LookupScope *b, implements.value(iface)) { Class *klass = 0; foreach (Symbol *s, b->symbols()) if ((klass = s->asClass()) != 0) @@ -331,7 +331,7 @@ public: Control *control = context.thisDocument()->control(); const Name *n = control->identifier(name.toLatin1().constData()); - if (ClassOrNamespace *bb = context.lookupType(n, klass)) { + if (LookupScope *bb = context.lookupType(n, klass)) { QString retTy; QString funcName = getAcceptFunctionName(bb, &retTy); Q_ASSERT(! funcName.isEmpty()); @@ -350,7 +350,7 @@ public: continue; } - if (ClassOrNamespace *ty = context.lookupType(namedTy->name(), klass)) { + if (LookupScope *ty = context.lookupType(namedTy->name(), klass)) { QString className = oo(ty->symbols().first()->name()); QString baseClassName = className; if (baseClassName.endsWith(QLatin1String("AST"))) { @@ -386,9 +386,9 @@ public: protected: using SymbolVisitor::visit; - QList<ClassOrNamespace *> baseClasses(ClassOrNamespace *b) { - QList<ClassOrNamespace *> usings = b->usings(); - foreach (ClassOrNamespace *u, usings) + QList<LookupScope *> baseClasses(LookupScope *b) { + QList<LookupScope *> usings = b->usings(); + foreach (LookupScope *u, usings) usings += baseClasses(u); return usings; } @@ -398,14 +398,14 @@ protected: if (! className.endsWith(QLatin1String("AST"))) return false; - ClassOrNamespace *b = context.lookupType(klass); + LookupScope *b = context.lookupType(klass); Q_ASSERT(b != 0); const Identifier *accept0 = context.thisDocument()->control()->identifier("accept0"); if (Symbol *s = klass->find(accept0)) { if (Function *meth = s->type()->asFunctionType()) { if (! meth->isPureVirtual()) { - foreach (ClassOrNamespace *u, b->usings()) { + foreach (LookupScope *u, b->usings()) { if (interfaces.contains(u)) { // qDebug() << oo(klass->name()) << "implements" << oo(u->symbols().first()->name()); } else { diff --git a/tests/auto/cplusplus/lookup/tst_lookup.cpp b/tests/auto/cplusplus/lookup/tst_lookup.cpp index 8347749f43..deab703a8f 100644 --- a/tests/auto/cplusplus/lookup/tst_lookup.cpp +++ b/tests/auto/cplusplus/lookup/tst_lookup.cpp @@ -133,7 +133,7 @@ void tst_Lookup::base_class_defined_1() const LookupContext ctx(doc, snapshot); - ClassOrNamespace *klass = ctx.lookupType(derivedClass->baseClassAt(0)->name(), derivedClass->enclosingScope()); + LookupScope *klass = ctx.lookupType(derivedClass->baseClassAt(0)->name(), derivedClass->enclosingScope()); QVERIFY(klass != 0); QCOMPARE(klass->symbols().size(), 1); @@ -272,7 +272,7 @@ void tst_Lookup::simple_class_1() const LookupContext context(doc, snapshot); // check class resolving: - ClassOrNamespace *klass = context.lookupType(impl->name(), impl->enclosingScope()); + LookupScope *klass = context.lookupType(impl->name(), impl->enclosingScope()); QVERIFY(klass != 0); QCOMPARE(klass->symbols().size(), 2); QVERIFY(klass->symbols().contains(iface)); @@ -336,7 +336,7 @@ void tst_Lookup::class_with_baseclass() const LookupContext context(doc, snapshot); - ClassOrNamespace *objClass = context.lookupType(baseZoo->name(), zooImpl->enclosingScope()); + LookupScope *objClass = context.lookupType(baseZoo->name(), zooImpl->enclosingScope()); QVERIFY(objClass != 0); QVERIFY(objClass->symbols().contains(baseZoo)); |