Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
48889e75
Commit
48889e75
authored
Mar 12, 2010
by
Erik Verbruggen
Browse files
Changed FindUsages to look into Q_PROPERTYs.
parent
a2ded1e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/FindUsages.cpp
View file @
48889e75
...
...
@@ -33,6 +33,7 @@
#include
<Control.h>
#include
<Literals.h>
#include
<Names.h>
#include
<Scope.h>
#include
<Symbols.h>
#include
<AST.h>
#include
<TranslationUnit.h>
...
...
@@ -47,7 +48,8 @@ FindUsages::FindUsages(Document::Ptr doc, const Snapshot &snapshot)
_snapshot
(
snapshot
),
_source
(
_doc
->
source
()),
_sem
(
doc
->
translationUnit
()),
_inSimpleDeclaration
(
0
)
_inSimpleDeclaration
(
0
),
_inQProperty
(
false
)
{
_snapshot
.
insert
(
_doc
);
}
...
...
@@ -70,6 +72,7 @@ void FindUsages::operator()(Symbol *symbol)
_usages
.
clear
();
_declSymbol
=
symbol
;
_inSimpleDeclaration
=
0
;
_inQProperty
=
false
;
_id
=
0
;
if
(
_declSymbol
&&
0
!=
(
_id
=
_declSymbol
->
identifier
()))
...
...
@@ -204,12 +207,19 @@ LookupContext FindUsages::currentContext(AST *ast)
getTokenStartPosition
(
ast
->
firstToken
(),
&
line
,
&
column
);
Symbol
*
lastVisibleSymbol
=
_doc
->
findSymbolAt
(
line
,
column
);
if
(
_inQProperty
&&
lastVisibleSymbol
->
isClass
())
{
Scope
*
memberScope
=
lastVisibleSymbol
->
asClass
()
->
members
();
if
(
unsigned
count
=
memberScope
->
symbolCount
())
lastVisibleSymbol
=
memberScope
->
symbolAt
(
count
-
1
);
}
if
(
lastVisibleSymbol
&&
lastVisibleSymbol
==
_previousContext
.
symbol
())
return
_previousContext
;
LookupContext
ctx
(
lastVisibleSymbol
,
_exprDoc
,
_doc
,
_snapshot
);
_previousContext
=
ctx
;
return
ctx
;
return
_previousContext
;
}
void
FindUsages
::
ensureNameIsValid
(
NameAST
*
ast
)
...
...
@@ -476,3 +486,12 @@ bool FindUsages::visit(ObjCSelectorAST *ast)
return
false
;
}
bool
FindUsages
::
visit
(
QtPropertyDeclarationAST
*
)
{
_inQProperty
=
true
;
return
true
;
}
void
FindUsages
::
endVisit
(
QtPropertyDeclarationAST
*
)
{
_inQProperty
=
false
;
}
src/libs/cplusplus/FindUsages.h
View file @
48889e75
...
...
@@ -100,6 +100,8 @@ protected:
virtual
bool
visit
(
FunctionDeclaratorAST
*
ast
);
virtual
bool
visit
(
SimpleDeclarationAST
*
);
virtual
bool
visit
(
ObjCSelectorAST
*
ast
);
virtual
bool
visit
(
QtPropertyDeclarationAST
*
);
virtual
void
endVisit
(
QtPropertyDeclarationAST
*
);
private:
const
Identifier
*
_id
;
...
...
@@ -116,6 +118,7 @@ private:
QList
<
Usage
>
_usages
;
LookupContext
_previousContext
;
int
_inSimpleDeclaration
;
bool
_inQProperty
;
QSet
<
unsigned
>
_processed
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment