Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
0a610c3b
Commit
0a610c3b
authored
Jun 26, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved the use highlighter.
parent
8433ba2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
6 deletions
+68
-6
src/plugins/cppeditor/cppeditor.cpp
src/plugins/cppeditor/cppeditor.cpp
+68
-6
No files found.
src/plugins/cppeditor/cppeditor.cpp
View file @
0a610c3b
...
...
@@ -217,9 +217,12 @@ public:
protected:
using
ASTVisitor
::
visit
;
bool
findMember
(
Scope
*
scope
,
Simple
NameAST
*
ast
,
unsigned
line
,
unsigned
column
)
bool
findMember
(
Scope
*
scope
,
NameAST
*
ast
,
unsigned
line
,
unsigned
column
)
{
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
if
(
!
(
ast
&&
ast
->
name
))
return
false
;
Identifier
*
id
=
ast
->
name
->
identifier
();
if
(
scope
)
{
for
(
Symbol
*
member
=
scope
->
lookat
(
id
);
member
;
member
=
member
->
next
())
{
...
...
@@ -270,9 +273,62 @@ protected:
return
false
;
}
virtual
bool
visit
(
QualifiedNameAST
*
)
virtual
bool
visit
(
TemplateIdAST
*
ast
)
{
// ### visit the template arguments.
unsigned
line
,
column
;
getTokenStartPosition
(
ast
->
firstToken
(),
&
line
,
&
column
);
FindScope
findScope
;
Scope
*
scope
=
findScope
(
line
,
column
,
_functionScope
->
owner
(),
translationUnit
());
while
(
scope
)
{
if
(
scope
->
isFunctionScope
())
{
Function
*
fun
=
scope
->
owner
()
->
asFunction
();
if
(
findMember
(
fun
->
members
(),
ast
,
line
,
column
))
return
false
;
else
if
(
findMember
(
fun
->
arguments
(),
ast
,
line
,
column
))
return
false
;
}
else
if
(
scope
->
isBlockScope
())
{
if
(
findMember
(
scope
,
ast
,
line
,
column
))
return
false
;
}
else
{
break
;
}
scope
=
scope
->
enclosingScope
();
}
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
externalUses
[
id
].
append
(
Use
(
ast
,
line
,
column
,
id
->
size
()));
for
(
TemplateArgumentListAST
*
arg
=
ast
->
template_arguments
;
arg
;
arg
=
arg
->
next
)
accept
(
arg
);
return
false
;
}
virtual
bool
visit
(
QualifiedNameAST
*
ast
)
{
if
(
!
ast
->
global_scope_token
)
{
if
(
ast
->
nested_name_specifier
)
{
accept
(
ast
->
nested_name_specifier
->
class_or_namespace_name
);
for
(
NestedNameSpecifierAST
*
it
=
ast
->
nested_name_specifier
->
next
;
it
;
it
=
it
->
next
)
{
if
(
NameAST
*
class_or_namespace_name
=
it
->
class_or_namespace_name
)
{
if
(
TemplateIdAST
*
template_id
=
class_or_namespace_name
->
asTemplateId
())
{
for
(
TemplateArgumentListAST
*
arg
=
template_id
->
template_arguments
;
arg
;
arg
=
arg
->
next
)
accept
(
arg
);
}
}
}
}
accept
(
ast
->
unqualified_name
);
}
return
false
;
}
...
...
@@ -878,6 +934,9 @@ static void highlightUses(QTextDocument *doc,
const
QList
<
FindUses
::
Use
>
&
uses
,
QList
<
QTextEdit
::
ExtraSelection
>
*
selections
)
{
if
(
uses
.
size
()
<=
1
)
return
;
foreach
(
const
FindUses
::
Use
&
use
,
uses
)
{
NameAST
*
name
=
use
.
name
;
bool
generated
=
false
;
...
...
@@ -892,8 +951,11 @@ static void highlightUses(QTextDocument *doc,
if
(
!
generated
)
{
unsigned
startLine
,
startColumn
;
unsigned
endLine
,
endColumn
;
translationUnit
->
getTokenStartPosition
(
name
->
firstToken
(),
&
startLine
,
&
startColumn
);
translationUnit
->
getTokenEndPosition
(
name
->
lastToken
()
-
1
,
&
endLine
,
&
endColumn
);
unsigned
identifier_token
=
name
->
firstToken
();
translationUnit
->
getTokenStartPosition
(
identifier_token
,
&
startLine
,
&
startColumn
);
translationUnit
->
getTokenEndPosition
(
identifier_token
,
&
endLine
,
&
endColumn
);
QTextEdit
::
ExtraSelection
sel
;
sel
.
cursor
=
QTextCursor
(
doc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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