Skip to content
Snippets Groups Projects
Commit f1a40d30 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixes: Member completion when the symbol's type is ClassTy.

For example,

struct {
  int a, b
} foo;

int main() {
  foo.  <-
}
parent 63a5f15f
No related branches found
No related tags found
No related merge requests found
...@@ -598,7 +598,9 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re ...@@ -598,7 +598,9 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
if (ReferenceType *refTy = ty->asReferenceType()) if (ReferenceType *refTy = ty->asReferenceType())
ty = refTy->elementType(); ty = refTy->elementType();
if (NamedType *namedTy = ty->asNamedType()) { if (Class *classTy = ty->asClass()) {
classObjectCandidates.append(classTy);
} else if (NamedType *namedTy = ty->asNamedType()) {
// ### This code is pretty slow. // ### This code is pretty slow.
const QList<Symbol *> candidates = context.resolve(namedTy->name()); const QList<Symbol *> candidates = context.resolve(namedTy->name());
foreach (Symbol *candidate, candidates) { foreach (Symbol *candidate, candidates) {
...@@ -697,6 +699,8 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re ...@@ -697,6 +699,8 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
++m_startPosition; ++m_startPosition;
namedTy = ptrTy->elementType()->asNamedType(); namedTy = ptrTy->elementType()->asNamedType();
} }
} else if (Class *classTy = ty->asClass()) {
classObjectCandidates.append(classTy);
} else { } else {
namedTy = ty->asNamedType(); namedTy = ty->asNamedType();
if (! namedTy) { if (! namedTy) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment