Replace . with -> only when the base expression has type pointer to class.

Reviewed-by: Thorbjørn Lindeijer
This commit is contained in:
Roberto Raggi
2009-11-04 18:21:35 +01:00
parent 4ceabf26d4
commit f2a0382910

View File

@@ -1121,14 +1121,6 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &ba
m_completionOperator,
&replacedDotOperator);
if (replacedDotOperator) {
// Replace . with ->
int length = m_editor->position() - m_startPosition + 1;
m_editor->setCurPos(m_startPosition - 1);
m_editor->replace(length, QLatin1String("->"));
++m_startPosition;
}
QList<Symbol *> classObjectCandidates;
foreach (const TypeOfExpression::Result &r, classObjectResults) {
FullySpecifiedType ty = r.first.simplified();
@@ -1147,6 +1139,14 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &ba
}
}
if (replacedDotOperator && ! classObjectCandidates.isEmpty()) {
// Replace . with ->
int length = m_editor->position() - m_startPosition + 1;
m_editor->setCurPos(m_startPosition - 1);
m_editor->replace(length, QLatin1String("->"));
++m_startPosition;
}
completeClass(classObjectCandidates, context, /*static lookup = */ false);
if (! m_completions.isEmpty())
return true;