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

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

Reviewed-by: Thorbjørn Lindeijer
(cherry picked from commit f2a03829)
parent 6b2c4d08
No related branches found
No related tags found
No related merge requests found
...@@ -1117,14 +1117,6 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &ba ...@@ -1117,14 +1117,6 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &ba
m_completionOperator, m_completionOperator,
&replacedDotOperator); &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; QList<Symbol *> classObjectCandidates;
foreach (const TypeOfExpression::Result &r, classObjectResults) { foreach (const TypeOfExpression::Result &r, classObjectResults) {
FullySpecifiedType ty = r.first.simplified(); FullySpecifiedType ty = r.first.simplified();
...@@ -1143,6 +1135,14 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &ba ...@@ -1143,6 +1135,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); completeClass(classObjectCandidates, context, /*static lookup = */ false);
if (! m_completions.isEmpty()) if (! m_completions.isEmpty())
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment