Commit c7b023c0 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Renamed SymbolsForDotAccess to ResolveClass.

parent 7c3d1a01
......@@ -427,7 +427,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
bool ResolveExpression::visit(QualifiedNameAST *ast)
{
SymbolsForDotAccess symbolsForDotAcces;
ResolveClass symbolsForDotAcces;
Scope dummy;
Name *name = sem.check(ast, &dummy);
......@@ -537,7 +537,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
_results.clear();
const QList<Result> indexResults = operator()(ast->expression);
SymbolsForDotAccess symbolsForDotAcccess;
ResolveClass symbolsForDotAcccess;
foreach (Result p, baseResults) {
FullySpecifiedType ty = p.first;
......@@ -595,7 +595,7 @@ ResolveExpression::resolveMemberExpression(const QList<Result> &baseResults,
unsigned accessOp,
Name *memberName) const
{
SymbolsForDotAccess symbolsForDotAccess;
ResolveClass resolveClass;
QList<Result> results;
if (accessOp == T_ARROW) {
......@@ -607,7 +607,7 @@ ResolveExpression::resolveMemberExpression(const QList<Result> &baseResults,
if (NamedType *namedTy = ty->asNamedType()) {
const QList<Symbol *> classObjectCandidates =
symbolsForDotAccess(namedTy, p, _context);
resolveClass(namedTy, p, _context);
foreach (Symbol *classObject, classObjectCandidates) {
const QList<Result> overloads = resolveArrowOperator(p, namedTy,
......@@ -667,10 +667,10 @@ ResolveExpression::resolveMember(const Result &p,
Name *memberName,
NamedType *namedTy) const
{
SymbolsForDotAccess symbolsForDotAccess;
ResolveClass resolveClass;
const QList<Symbol *> classObjectCandidates =
symbolsForDotAccess(namedTy, p, _context);
resolveClass(namedTy, p, _context);
QList<Result> results;
foreach (Symbol *classObject, classObjectCandidates) {
......@@ -799,29 +799,29 @@ bool ResolveExpression::visit(PostIncrDecrAST *)
}
////////////////////////////////////////////////////////////////////////////////
SymbolsForDotAccess::SymbolsForDotAccess()
ResolveClass::ResolveClass()
{ }
QList<Symbol *> SymbolsForDotAccess::operator()(NamedType *namedTy,
QList<Symbol *> ResolveClass::operator()(NamedType *namedTy,
ResolveExpression::Result p,
const LookupContext &context)
{
const QList<ResolveExpression::Result> previousBlackList = _blackList;
const QList<Symbol *> symbols = symbolsForDotAccess(namedTy, p, context);
const QList<Symbol *> symbols = resolveClass(namedTy, p, context);
_blackList = previousBlackList;
return symbols;
}
QList<Symbol *> SymbolsForDotAccess::operator()(ResolveExpression::Result p,
QList<Symbol *> ResolveClass::operator()(ResolveExpression::Result p,
const LookupContext &context)
{
const QList<ResolveExpression::Result> previousBlackList = _blackList;
const QList<Symbol *> symbols = symbolsForDotAccess(p, context);
const QList<Symbol *> symbols = resolveClass(p, context);
_blackList = previousBlackList;
return symbols;
}
QList<Symbol *> SymbolsForDotAccess::symbolsForDotAccess(NamedType *namedTy,
QList<Symbol *> ResolveClass::resolveClass(NamedType *namedTy,
ResolveExpression::Result p,
const LookupContext &context)
{
......@@ -852,7 +852,7 @@ QList<Symbol *> SymbolsForDotAccess::symbolsForDotAccess(NamedType *namedTy,
// Boh b;
// b.
const ResolveExpression::Result r(decl->type(), decl);
resolvedSymbols += symbolsForDotAccess(r, context);
resolvedSymbols += resolveClass(r, context);
}
}
} else if (Declaration *decl = candidate->asDeclaration()) {
......@@ -861,7 +861,7 @@ QList<Symbol *> SymbolsForDotAccess::symbolsForDotAccess(NamedType *namedTy,
// foo.
if (funTy->scope()->isBlockScope() || funTy->scope()->isNamespaceScope()) {
const ResolveExpression::Result r(funTy->returnType(), decl);
resolvedSymbols += symbolsForDotAccess(r, context);
resolvedSymbols += resolveClass(r, context);
}
}
}
......@@ -870,16 +870,16 @@ QList<Symbol *> SymbolsForDotAccess::symbolsForDotAccess(NamedType *namedTy,
return resolvedSymbols;
}
QList<Symbol *> SymbolsForDotAccess::symbolsForDotAccess(ResolveExpression::Result p,
QList<Symbol *> ResolveClass::resolveClass(ResolveExpression::Result p,
const LookupContext &context)
{
FullySpecifiedType ty = p.first;
if (NamedType *namedTy = ty->asNamedType()) {
return symbolsForDotAccess(namedTy, p, context);
return resolveClass(namedTy, p, context);
} else if (ReferenceType *refTy = ty->asReferenceType()) {
const ResolveExpression::Result e(refTy->elementType(), p.second);
return symbolsForDotAccess(e, context);
return resolveClass(e, context);
}
return QList<Symbol *>();
......
......@@ -128,10 +128,10 @@ private:
QList<Result> _results;
};
class CPLUSPLUS_EXPORT SymbolsForDotAccess
class CPLUSPLUS_EXPORT ResolveClass
{
public:
SymbolsForDotAccess();
ResolveClass();
QList<Symbol *> operator()(NamedType *namedTy,
ResolveExpression::Result p,
......@@ -141,11 +141,11 @@ public:
const LookupContext &context);
private:
QList<Symbol *> symbolsForDotAccess(NamedType *namedTy,
QList<Symbol *> resolveClass(NamedType *namedTy,
ResolveExpression::Result p,
const LookupContext &context);
QList<Symbol *> symbolsForDotAccess(ResolveExpression::Result p,
QList<Symbol *> resolveClass(ResolveExpression::Result p,
const LookupContext &context);
private:
......
......@@ -592,10 +592,9 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
if (NamedType *namedTy = ty->asNamedType()) {
ResolveExpression resolveExpression(context);
SymbolsForDotAccess symbolsForDotAccess;
ResolveClass resolveClass;
const QList<Symbol *> candidates = symbolsForDotAccess(namedTy, p,
context);
const QList<Symbol *> candidates = resolveClass(namedTy, p, context);
foreach (Symbol *classObject, candidates) {
const QList<TypeOfExpression::Result> overloads =
......@@ -616,7 +615,7 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
if (PointerType *ptrTy = ty->asPointerType()) {
if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
const QList<Symbol *> classes =
symbolsForDotAccess(namedTy, p, context);
resolveClass(namedTy, p, context);
foreach (Symbol *c, classes) {
if (! classObjectCandidates.contains(c))
......@@ -628,9 +627,9 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
}
} else if (PointerType *ptrTy = ty->asPointerType()) {
if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
SymbolsForDotAccess symbolsForDotAccess;
ResolveClass resolveClass;
const QList<Symbol *> classes = symbolsForDotAccess(namedTy, p,
const QList<Symbol *> classes = resolveClass(namedTy, p,
context);
foreach (Symbol *c, classes) {
......@@ -663,8 +662,8 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
}
if (namedTy) {
SymbolsForDotAccess symbolsForDotAccess;
const QList<Symbol *> symbols = symbolsForDotAccess(namedTy, p, context);
ResolveClass resolveClass;
const QList<Symbol *> symbols = resolveClass(namedTy, p, context);
foreach (Symbol *symbol, symbols) {
if (classObjectCandidates.contains(symbol))
continue;
......@@ -715,8 +714,8 @@ bool CppCodeCompletion::completeScope(const QList<TypeOfExpression::Result> &res
completeClass(candidates, context);
} else if (Symbol *symbol = result.second) {
if (symbol->isTypedef()) {
SymbolsForDotAccess symbolsForDotAccess;
const QList<Symbol *> candidates = symbolsForDotAccess(result,
ResolveClass resolveClass;
const QList<Symbol *> candidates = resolveClass(result,
context);
completeClass(candidates, context);
}
......@@ -829,6 +828,8 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
if (results.isEmpty())
return false;
ResolveClass resolveClass;
ConvertToCompletionItem toCompletionItem(this);
Overview o;
o.setShowReturnTypes(false);
......@@ -849,10 +850,8 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
if (! namedTy) // not a class name.
continue;
const QList<Scope *> visibleScopes = context.visibleScopes(p);
const QList<Symbol *> classObjects =
context.resolveClass(namedTy->name(), visibleScopes);
resolveClass(namedTy, p, context);
if (classObjects.isEmpty())
continue;
......@@ -860,6 +859,7 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
Class *klass = classObjects.first()->asClass();
QList<Scope *> todo;
const QList<Scope *> visibleScopes = context.visibleScopes(p);
context.expand(klass->members(), visibleScopes, &todo);
foreach (Scope *scope, todo) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment