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
20ff553b
Commit
20ff553b
authored
Sep 25, 2009
by
Roberto Raggi
Browse files
Introduced LookupContext::canonicalSymbol().
parent
e9a5ab1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
20ff553b
...
...
@@ -495,3 +495,41 @@ void LookupContext::expand(Scope *scope,
expandObjCMethod
(
meth
,
visibleScopes
,
expandedScopes
);
}
}
Symbol
*
LookupContext
::
canonicalSymbol
(
Symbol
*
symbol
)
{
Symbol
*
canonical
=
symbol
;
for
(;
symbol
;
symbol
=
symbol
->
next
())
{
if
(
symbol
->
name
()
==
canonical
->
name
())
canonical
=
symbol
;
}
return
canonical
;
}
Symbol
*
LookupContext
::
canonicalSymbol
(
const
QList
<
Symbol
*>
&
candidates
)
{
if
(
candidates
.
isEmpty
())
return
0
;
Symbol
*
candidate
=
candidates
.
first
();
if
(
candidate
->
scope
()
->
isClassScope
()
&&
candidate
->
type
()
->
isFunctionType
())
{
Function
*
function
=
0
;
for
(
int
i
=
0
;
i
<
candidates
.
size
();
++
i
)
{
Symbol
*
c
=
candidates
.
at
(
i
);
if
(
!
c
->
scope
()
->
isClassScope
())
continue
;
// ### or break?
else
if
(
Function
*
f
=
c
->
type
()
->
asFunctionType
())
{
if
(
f
->
isVirtual
())
function
=
f
;
}
}
if
(
function
)
return
canonicalSymbol
(
function
);
}
return
canonicalSymbol
(
candidate
);
}
src/libs/cplusplus/LookupContext.h
View file @
20ff553b
...
...
@@ -54,6 +54,9 @@ public:
Document
::
Ptr
document
(
const
QString
&
fileName
)
const
;
Snapshot
snapshot
()
const
;
static
Symbol
*
canonicalSymbol
(
Symbol
*
symbol
);
static
Symbol
*
canonicalSymbol
(
const
QList
<
Symbol
*>
&
candidates
);
QList
<
Symbol
*>
resolve
(
Name
*
name
)
const
{
return
resolve
(
name
,
visibleScopes
());
}
...
...
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