forked from qt-creator/qt-creator
		
	C++: Changes in semantic highlighting
- Fix issues with virtual/non-virtual destructors. They were not being correctly identified in some cases - in particular on certain uses in derived classes. - Since now we do have a highlighting item for regular functions, constructors and destructors are now highlighted as such. This is more semantically correct and actually makes navigation and readiblity more distinguishable, since it cleary differentiates the type itself from its uses in expressions and declarators. (This seems to be what other IDEs like Eclipse, Visual Studio, KDevelop are doing.) NOTE: There's a switch to disable this item in the case it doesn't get good acceptance. Actually, the switch can be made a user setting...? - Change the default color scheme so regular and virtual functions have the same color (virtuals continue to be italic). This makes sense given the above mentioned changes in constructors/destructors highlighting behavior. (In other schemes virtual funcions don't have different color, so this shouldn't be necessary in those.) - Small renaming: "members" are now "fields" - consistent, since they apply for data and it's the term used in the UI. Change-Id: Ib1aa9c0bbf28a31d09f5696460b0095fbe29de80 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
		| @@ -105,12 +105,13 @@ protected: | ||||
|     QByteArray textOf(AST *ast) const; | ||||
|  | ||||
|     bool maybeType(const Name *name) const; | ||||
|     bool maybeMember(const Name *name) const; | ||||
|     bool maybeField(const Name *name) const; | ||||
|     bool maybeStatic(const Name *name) const; | ||||
|     bool maybeFunction(const Name *name) const; | ||||
|  | ||||
|     void checkName(NameAST *ast, Scope *scope = 0); | ||||
|     void checkNamespace(NameAST *name); | ||||
|     void checkName(NameAST *ast, Scope *scope = 0); | ||||
|     ClassOrNamespace *checkNestedName(QualifiedNameAST *ast); | ||||
|  | ||||
|     void addUse(const Use &use); | ||||
|     void addUse(unsigned tokenIndex, UseKind kind); | ||||
| @@ -118,10 +119,9 @@ protected: | ||||
|  | ||||
|     void addType(ClassOrNamespace *b, NameAST *ast); | ||||
|  | ||||
|     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 addFunction(const QList<LookupItem> &candidates, NameAST *ast, unsigned argumentCount); | ||||
|     bool maybeAddTypeOrStatic(const QList<LookupItem> &candidates, NameAST *ast); | ||||
|     bool maybeAddField(const QList<LookupItem> &candidates, NameAST *ast); | ||||
|     bool maybeAddFunction(const QList<LookupItem> &candidates, NameAST *ast, unsigned argumentCount); | ||||
|  | ||||
|     bool isTemplateClass(Symbol *s) const; | ||||
|  | ||||
| @@ -135,31 +135,32 @@ protected: | ||||
|     virtual bool visit(NamespaceAST *); | ||||
|     virtual bool visit(UsingDirectiveAST *); | ||||
|     virtual bool visit(SimpleDeclarationAST *); | ||||
|     virtual bool visit(NamedTypeSpecifierAST *); | ||||
|     virtual bool visit(ElaboratedTypeSpecifierAST *ast); | ||||
|     virtual bool visit(TypenameTypeParameterAST *ast); | ||||
|     virtual bool visit(TemplateTypeParameterAST *ast); | ||||
|     virtual bool visit(FunctionDefinitionAST *ast); | ||||
|     virtual bool visit(ParameterDeclarationAST *ast); | ||||
|  | ||||
|     virtual bool visit(EnumeratorAST *); | ||||
|     virtual bool visit(ElaboratedTypeSpecifierAST *ast); | ||||
|  | ||||
|     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); | ||||
|  | ||||
|     virtual bool visit(TypenameTypeParameterAST *ast); | ||||
|     virtual bool visit(TemplateTypeParameterAST *ast); | ||||
|  | ||||
|     virtual bool visit(FunctionDefinitionAST *ast); | ||||
|     virtual bool visit(MemberAccessAST *ast); | ||||
|     virtual bool visit(CallAST *ast); | ||||
|  | ||||
|     virtual bool visit(MemInitializerAST *ast); | ||||
|     virtual bool visit(NewExpressionAST *ast); | ||||
|  | ||||
|     virtual bool visit(GotoStatementAST *ast); | ||||
|     virtual bool visit(LabeledStatementAST *ast); | ||||
|  | ||||
|     virtual bool visit(MemInitializerAST *ast); | ||||
|     virtual bool visit(EnumeratorAST *ast); | ||||
|  | ||||
|     NameAST *declaratorId(DeclaratorAST *ast) const; | ||||
|  | ||||
|     static unsigned referenceToken(NameAST *name); | ||||
|  | ||||
|     void flush(); | ||||
|  | ||||
| private: | ||||
| @@ -168,7 +169,7 @@ private: | ||||
|     TypeOfExpression typeOfExpression; | ||||
|     QString _fileName; | ||||
|     QSet<QByteArray> _potentialTypes; | ||||
|     QSet<QByteArray> _potentialMembers; | ||||
|     QSet<QByteArray> _potentialFields; | ||||
|     QSet<QByteArray> _potentialFunctions; | ||||
|     QSet<QByteArray> _potentialStatics; | ||||
|     QList<AST *> _astStack; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user