Skip to content
GitLab
Menu
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
6a3382d8
Commit
6a3382d8
authored
May 28, 2009
by
Roberto Raggi
Browse files
Say hello to LookupContext::resolveNestedNameSpecifier()
parent
6a5d81b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
6a3382d8
...
...
@@ -126,59 +126,48 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol,
return
false
;
}
QList
<
Symbol
*>
LookupContext
::
resolveQualifiedNameId
(
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
QList
<
Scope
*>
LookupContext
::
resolveNestedNameSpecifier
(
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
)
const
{
QList
<
Scope
*>
scopes
=
visibleScopes
;
QList
<
Symbol
*>
candidates
;
QList
<
Scope
*>
scopes
=
visibleScopes
;
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
();
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
()
-
1
;
++
i
)
{
Name
*
name
=
q
->
nameAt
(
i
);
if
(
i
+
1
==
q
->
nameCount
())
candidates
=
resolve
(
name
,
scopes
,
mode
);
else
candidates
=
resolveClassOrNamespace
(
name
,
scopes
);
candidates
=
resolveClassOrNamespace
(
name
,
scopes
);
if
(
candidates
.
isEmpty
()
||
i
+
1
==
q
->
nameCount
()
)
if
(
candidates
.
isEmpty
())
break
;
scopes
.
clear
();
foreach
(
Symbol
*
candidate
,
candidates
)
{
if
(
ScopedSymbol
*
scoped
=
candidate
->
asScopedSymbol
())
{
scopes
.
append
(
scoped
->
members
());
}
ScopedSymbol
*
scoped
=
candidate
->
asScopedSymbol
();
Scope
*
members
=
scoped
->
members
();
if
(
!
scopes
.
contains
(
members
))
scopes
.
append
(
members
);
}
}
Identifier
*
id
=
q
->
identifier
();
foreach
(
Scope
*
scope
,
visibleScopes
)
{
Symbol
*
symbol
=
scope
->
lookat
(
id
);
for
(;
symbol
;
symbol
=
symbol
->
next
())
{
if
(
!
symbol
->
name
())
continue
;
else
if
(
!
maybeValidSymbol
(
symbol
,
mode
,
candidates
))
continue
;
QualifiedNameId
*
qq
=
symbol
->
name
()
->
asQualifiedNameId
();
if
(
!
qq
)
continue
;
if
(
q
->
nameCount
()
>
qq
->
nameCount
())
continue
;
return
scopes
;
}
QList
<
Symbol
*>
LookupContext
::
resolveQualifiedNameId
(
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
{
QList
<
Scope
*>
scopes
;
for
(
int
i
=
q
->
nameCount
()
-
1
;
i
!=
-
1
;
--
i
)
{
Name
*
a
=
q
->
nameAt
(
i
);
Name
*
b
=
qq
->
nameAt
(
i
);
if
(
q
->
nameCount
()
==
1
)
scopes
=
visibleScopes
;
// ### handle global scope lookup
else
scopes
=
resolveNestedNameSpecifier
(
q
,
visibleScopes
);
if
(
!
a
->
isEqualTo
(
b
))
break
;
else
if
(
i
==
0
)
candidates
.
append
(
symbol
);
}
}
}
// ### expand the scopes.
return
candidates
;
return
resolve
(
q
->
unqualifiedNameId
(),
scopes
,
mode
)
;
}
QList
<
Symbol
*>
LookupContext
::
resolveOperatorNameId
(
OperatorNameId
*
opId
,
...
...
src/libs/cplusplus/LookupContext.h
View file @
6a3382d8
...
...
@@ -123,6 +123,9 @@ private:
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
;
QList
<
Scope
*>
resolveNestedNameSpecifier
(
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
)
const
;
Identifier
*
identifier
(
const
Name
*
name
)
const
;
QList
<
Scope
*>
buildVisibleScopes
();
...
...
Write
Preview
Supports
Markdown
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