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

Cleanup

parent c2f61a76
......@@ -512,22 +512,21 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
context = typeOfExpression.lookupContext();
}
if (! resolvedTypes.isEmpty() && resolvedTypes.first().first) {
FullySpecifiedType exprTy = resolvedTypes.first().first;
if (exprTy->isReferenceType())
exprTy = exprTy->asReferenceType()->elementType();
if (m_completionOperator == T_LPAREN && completeConstructorOrFunction(exprTy, resolvedTypes)) {
if (! resolvedTypes.isEmpty()) {
if (m_completionOperator == T_LPAREN && completeConstructorOrFunction(resolvedTypes)) {
return m_startPosition;
} else if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) &&
completeMember(resolvedTypes, context)) {
return m_startPosition;
} else if (m_completionOperator == T_COLON_COLON && completeScope(resolvedTypes, context)) {
return m_startPosition;
} else if (m_completionOperator == T_SIGNAL && completeSignal(exprTy, resolvedTypes, context)) {
} else if (m_completionOperator == T_SIGNAL && completeSignal(resolvedTypes, context)) {
return m_startPosition;
} else if (m_completionOperator == T_SLOT && completeSlot(exprTy, resolvedTypes, context)) {
} else if (m_completionOperator == T_SLOT && completeSlot(resolvedTypes, context)) {
return m_startPosition;
}
}
......@@ -550,8 +549,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
// If it's a class, add completions for the constructors
foreach (const TypeOfExpression::Result &result, results) {
if (result.first->isClassType()) {
FullySpecifiedType exprTy = result.first;
if (completeConstructorOrFunction(exprTy, QList<TypeOfExpression::Result>()))
if (completeConstructorOrFunction(results))
return m_startPosition;
break;
}
......@@ -563,8 +561,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
return -1;
}
bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType,
const QList<TypeOfExpression::Result> &results)
bool CppCodeCompletion::completeConstructorOrFunction(const QList<TypeOfExpression::Result> &results)
{
ConvertToCompletionItem toCompletionItem(this);
Overview o;
......@@ -924,8 +921,7 @@ void CppCodeCompletion::completeClass(const QList<Symbol *> &candidates,
}
}
bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
const QList<TypeOfExpression::Result> &results,
bool CppCodeCompletion::completeQtMethod(const QList<TypeOfExpression::Result> &results,
const LookupContext &context,
bool wantSignals)
{
......@@ -941,7 +937,7 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
o.setShowFunctionSignatures(true);
QSet<QString> signatures;
foreach (TypeOfExpression::Result p, results) {
foreach (const TypeOfExpression::Result &p, results) {
FullySpecifiedType ty = p.first;
if (ReferenceType *refTy = ty->asReferenceType())
ty = refTy->elementType();
......
......@@ -90,8 +90,7 @@ private:
QSet<QString> *definedMacros);
void addCompletionItem(CPlusPlus::Symbol *symbol);
bool completeConstructorOrFunction(CPlusPlus::FullySpecifiedType exprTy,
const QList<CPlusPlus::TypeOfExpression::Result> &);
bool completeConstructorOrFunction(const QList<CPlusPlus::TypeOfExpression::Result> &);
bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &,
const CPlusPlus::LookupContext &context);
......@@ -108,20 +107,17 @@ private:
bool completeConstructors(CPlusPlus::Class *klass);
bool completeQtMethod(CPlusPlus::FullySpecifiedType exprTy,
const QList<CPlusPlus::TypeOfExpression::Result> &,
bool completeQtMethod(const QList<CPlusPlus::TypeOfExpression::Result> &,
const CPlusPlus::LookupContext &context,
bool wantSignals);
bool completeSignal(CPlusPlus::FullySpecifiedType exprTy,
const QList<CPlusPlus::TypeOfExpression::Result> &results,
bool completeSignal(const QList<CPlusPlus::TypeOfExpression::Result> &results,
const CPlusPlus::LookupContext &context)
{ return completeQtMethod(exprTy, results, context, true); }
{ return completeQtMethod(results, context, true); }
bool completeSlot(CPlusPlus::FullySpecifiedType exprTy,
const QList<CPlusPlus::TypeOfExpression::Result> &results,
bool completeSlot(const QList<CPlusPlus::TypeOfExpression::Result> &results,
const CPlusPlus::LookupContext &context)
{ return completeQtMethod(exprTy, results, context, false); }
{ return completeQtMethod(results, context, false); }
int findStartOfName(int pos = -1) const;
......
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