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

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

Reviewed-by: Thorbjørn Lindeijer
parent 4ceabf26
......@@ -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;
......
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