Commit 437bbd00 authored by Roberto Raggi's avatar Roberto Raggi

Don't insert `(' when completing ambiguous symbols.

parent 937340cc
...@@ -1128,7 +1128,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) ...@@ -1128,7 +1128,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
if (function->argumentCount() == 0) { if (function->argumentCount() == 0) {
extraChars += QLatin1Char('<'); extraChars += QLatin1Char('<');
} }
} else { } else if (! function->isAmbiguous()) {
extraChars += QLatin1Char('('); extraChars += QLatin1Char('(');
// If the function takes no arguments, automatically place the closing parenthesis // If the function takes no arguments, automatically place the closing parenthesis
......
...@@ -157,6 +157,7 @@ bool CheckDeclarator::visit(NestedDeclaratorAST *ast) ...@@ -157,6 +157,7 @@ bool CheckDeclarator::visit(NestedDeclaratorAST *ast)
bool CheckDeclarator::visit(FunctionDeclaratorAST *ast) bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
{ {
Function *fun = control()->newFunction(ast->firstToken()); Function *fun = control()->newFunction(ast->firstToken());
fun->setAmbiguous(ast->as_cpp_initializer != 0);
ast->symbol = fun; ast->symbol = fun;
fun->setReturnType(_fullySpecifiedType); fun->setReturnType(_fullySpecifiedType);
......
...@@ -255,6 +255,12 @@ bool Function::isPureVirtual() const ...@@ -255,6 +255,12 @@ bool Function::isPureVirtual() const
void Function::setPureVirtual(bool isPureVirtual) void Function::setPureVirtual(bool isPureVirtual)
{ _isPureVirtual = isPureVirtual; } { _isPureVirtual = isPureVirtual; }
bool Function::isAmbiguous() const
{ return _isAmbiguous; }
void Function::setAmbiguous(bool isAmbiguous)
{ _isAmbiguous = isAmbiguous; }
void Function::visitSymbol0(SymbolVisitor *visitor) void Function::visitSymbol0(SymbolVisitor *visitor)
{ {
if (visitor->visit(this)) { if (visitor->visit(this)) {
......
...@@ -322,6 +322,9 @@ public: ...@@ -322,6 +322,9 @@ public:
virtual Function *asFunctionType() virtual Function *asFunctionType()
{ return this; } { return this; }
bool isAmbiguous() const; // internal
void setAmbiguous(bool isAmbiguous); // internal
protected: protected:
virtual void visitSymbol0(SymbolVisitor *visitor); virtual void visitSymbol0(SymbolVisitor *visitor);
virtual void accept0(TypeVisitor *visitor); virtual void accept0(TypeVisitor *visitor);
...@@ -337,6 +340,7 @@ private: ...@@ -337,6 +340,7 @@ private:
unsigned _isPureVirtual: 1; unsigned _isPureVirtual: 1;
unsigned _isConst: 1; unsigned _isConst: 1;
unsigned _isVolatile: 1; unsigned _isVolatile: 1;
unsigned _isAmbiguous: 1;
unsigned _methodKey: 3; unsigned _methodKey: 3;
}; };
}; };
......
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