forked from qt-creator/qt-creator
		
	Replace . with -> only when the base expression has type pointer to class.
Reviewed-by: Thorbjørn Lindeijer
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user