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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user