forked from qt-creator/qt-creator
C++: Rename ClassOrNamespace -> LookupScope
Change-Id: Ide74482b133dd1fec40a725d9aa81bd749385f37 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
9e1e11db60
commit
cb350bfeb2
2
src/libs/3rdparty/cplusplus/Names.h
vendored
2
src/libs/3rdparty/cplusplus/Names.h
vendored
@@ -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; }
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ FullySpecifiedType SubstitutionMap::apply(const Name *name, Rewrite *) const
|
||||
}
|
||||
|
||||
|
||||
UseMinimalNames::UseMinimalNames(ClassOrNamespace *target)
|
||||
UseMinimalNames::UseMinimalNames(LookupScope *target)
|
||||
: _target(target)
|
||||
{
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user