forked from qt-creator/qt-creator
Fixes: Constructor completion.
This commit is contained in:
@@ -563,14 +563,17 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType exprTy,
|
bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType,
|
||||||
const QList<TypeOfExpression::Result> &resolvedTypes)
|
const QList<TypeOfExpression::Result> &results)
|
||||||
{
|
{
|
||||||
ConvertToCompletionItem toCompletionItem(this);
|
ConvertToCompletionItem toCompletionItem(this);
|
||||||
Overview o;
|
Overview o;
|
||||||
o.setShowReturnTypes(true);
|
o.setShowReturnTypes(true);
|
||||||
o.setShowArgumentNames(true);
|
o.setShowArgumentNames(true);
|
||||||
|
|
||||||
|
foreach (const TypeOfExpression::Result &result, results) {
|
||||||
|
FullySpecifiedType exprTy = result.first;
|
||||||
|
|
||||||
if (Class *klass = exprTy->asClassType()) {
|
if (Class *klass = exprTy->asClassType()) {
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
||||||
Symbol *member = klass->memberAt(i);
|
Symbol *member = klass->memberAt(i);
|
||||||
@@ -585,10 +588,17 @@ bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType exprTy,
|
|||||||
m_completions.append(item);
|
m_completions.append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_completions.isEmpty()) {
|
||||||
QSet<QString> signatures;
|
QSet<QString> signatures;
|
||||||
foreach (TypeOfExpression::Result p, resolvedTypes) {
|
|
||||||
|
foreach (const TypeOfExpression::Result &p, results) {
|
||||||
FullySpecifiedType ty = p.first;
|
FullySpecifiedType ty = p.first;
|
||||||
|
|
||||||
if (Function *fun = ty->asFunctionType()) {
|
if (Function *fun = ty->asFunctionType()) {
|
||||||
if (TextEditor::CompletionItem item = toCompletionItem(fun)) {
|
if (TextEditor::CompletionItem item = toCompletionItem(fun)) {
|
||||||
QString signature;
|
QString signature;
|
||||||
|
Reference in New Issue
Block a user