CppHighlighter: highlight all functions/methods.

- Highlight all function/methods (not just virtual methods).
- Highlight as a function even if number of arguments does not match. In
  that case, add a diagnostic message to indicate there are too many/too
  few arguments.
- Fix highlighting of parameters in function declarations.
  These used to be handled indiferently, and they could be mistaken for
  type or field references.
- Properly highlight template method calls.

Change-Id: I6e61c9ee47763db95c62314f9cc1c4d398df38b3
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Francois Ferrand
2010-10-18 17:45:49 +02:00
committed by Leandro Melo
parent 16bca8b06c
commit 809611f346
14 changed files with 109 additions and 50 deletions

View File

@@ -107,7 +107,7 @@ protected:
bool maybeType(const Name *name) const;
bool maybeMember(const Name *name) const;
bool maybeStatic(const Name *name) const;
bool maybeVirtualMethod(const Name *name) const;
bool maybeFunction(const Name *name) const;
void checkName(NameAST *ast, Scope *scope = 0);
void checkNamespace(NameAST *name);
@@ -121,7 +121,7 @@ protected:
void addTypeOrStatic(const QList<LookupItem> &candidates, NameAST *ast);
void addStatic(const QList<LookupItem> &candidates, NameAST *ast);
void addClassMember(const QList<LookupItem> &candidates, NameAST *ast);
void addVirtualMethod(const QList<LookupItem> &candidates, NameAST *ast, unsigned argumentCount);
void addFunction(const QList<LookupItem> &candidates, NameAST *ast, unsigned argumentCount);
bool isTemplateClass(Symbol *s) const;
@@ -142,6 +142,7 @@ protected:
virtual bool visit(SimpleNameAST *ast);
virtual bool visit(DestructorNameAST *ast);
virtual bool visit(ParameterDeclarationAST *ast);
virtual bool visit(QualifiedNameAST *ast);
virtual bool visit(TemplateIdAST *ast);
@@ -166,10 +167,9 @@ private:
LookupContext _context;
TypeOfExpression typeOfExpression;
QString _fileName;
QList<Document::DiagnosticMessage> _diagnosticMessages;
QSet<QByteArray> _potentialTypes;
QSet<QByteArray> _potentialMembers;
QSet<QByteArray> _potentialVirtualMethods;
QSet<QByteArray> _potentialFunctions;
QSet<QByteArray> _potentialStatics;
QList<AST *> _astStack;
QVector<Use> _usages;