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
744d294f
Commit
744d294f
authored
May 21, 2010
by
Roberto Raggi
Browse files
Improved lookup of qualified names.
parent
3e9faabf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
744d294f
...
...
@@ -215,22 +215,48 @@ QList<Symbol *> LookupContext::lookup(const Name *name, Scope *scope) const
}
else
if
(
scope
->
isFunctionScope
())
{
Function
*
fun
=
scope
->
owner
()
->
asFunction
();
bindings
()
->
lookupInScope
(
name
,
fun
->
arguments
(),
&
candidates
,
/*templateId = */
0
);
for
(
TemplateParameters
*
it
=
fun
->
templateParameters
();
it
&&
candidates
.
isEmpty
();
it
=
it
->
previous
())
bindings
()
->
lookupInScope
(
name
,
it
->
scope
(),
&
candidates
,
/* templateId = */
0
);
if
(
!
candidates
.
isEmpty
())
break
;
// it's a
formal argument
.
break
;
// it's a
n argument or a template parameter
.
if
(
fun
->
name
()
&&
fun
->
name
()
->
isQualifiedNameId
())
{
if
(
ClassOrNamespace
*
binding
=
bindings
()
->
lookupType
(
fun
))
return
binding
->
lookup
(
name
);
if
(
ClassOrNamespace
*
binding
=
bindings
()
->
lookupType
(
fun
))
{
candidates
=
binding
->
lookup
(
name
);
if
(
!
candidates
.
isEmpty
())
return
candidates
;
}
}
// contunue, and look at the enclosing scope.
}
else
if
(
scope
->
isObjCMethodScope
())
{
ObjCMethod
*
method
=
scope
->
owner
()
->
asObjCMethod
();
bindings
()
->
lookupInScope
(
name
,
method
->
arguments
(),
&
candidates
,
/*templateId = */
0
);
if
(
!
candidates
.
isEmpty
())
break
;
// it's a formal argument.
}
else
if
(
scope
->
isClassScope
()
||
scope
->
isNamespaceScope
()
||
scope
->
isObjCClassScope
()
||
scope
->
isObjCProtocolScope
())
{
}
else
if
(
scope
->
isClassScope
())
{
Class
*
klass
=
scope
->
owner
()
->
asClass
();
for
(
TemplateParameters
*
it
=
klass
->
templateParameters
();
it
&&
candidates
.
isEmpty
();
it
=
it
->
previous
())
bindings
()
->
lookupInScope
(
name
,
it
->
scope
(),
&
candidates
,
/* templateId = */
0
);
if
(
!
candidates
.
isEmpty
())
break
;
// it's an argument or a template parameter.
if
(
ClassOrNamespace
*
binding
=
bindings
()
->
lookupType
(
klass
))
{
candidates
=
binding
->
lookup
(
name
);
if
(
!
candidates
.
isEmpty
())
return
candidates
;
}
}
else
if
(
scope
->
isNamespaceScope
()
||
scope
->
isObjCClassScope
()
||
scope
->
isObjCProtocolScope
())
{
if
(
ClassOrNamespace
*
binding
=
bindings
()
->
lookupType
(
scope
->
owner
()))
return
binding
->
lookup
(
name
);
...
...
@@ -458,6 +484,14 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
if
(
ClassOrNamespace
*
e
=
nestedType
(
name
))
return
e
;
else
if
(
_templateId
)
{
Q_ASSERT
(
_usings
.
size
()
==
1
);
ClassOrNamespace
*
delegate
=
_usings
.
first
();
if
(
ClassOrNamespace
*
r
=
delegate
->
lookupType_helper
(
name
,
processed
,
/*searchInEnclosingScope = */
true
))
return
r
;
}
foreach
(
ClassOrNamespace
*
u
,
usings
())
{
if
(
ClassOrNamespace
*
r
=
u
->
lookupType_helper
(
name
,
processed
,
/*searchInEnclosingScope =*/
false
))
return
r
;
...
...
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