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
faaab90a
Commit
faaab90a
authored
May 28, 2009
by
Roberto Raggi
Browse files
Added LookupContext::resolveOperatorNameId() with the bits needed to resolve operator name ids.
parent
da91a048
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/LookupContext.cpp
View file @
faaab90a
...
...
@@ -181,20 +181,45 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
return
candidates
;
}
QList
<
Symbol
*>
LookupContext
::
resolveOperatorNameId
(
OperatorNameId
*
opId
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
)
const
{
QList
<
Symbol
*>
candidates
;
for
(
int
scopeIndex
=
0
;
scopeIndex
<
visibleScopes
.
size
();
++
scopeIndex
)
{
Scope
*
scope
=
visibleScopes
.
at
(
scopeIndex
);
for
(
Symbol
*
symbol
=
scope
->
lookat
(
opId
->
kind
());
symbol
;
symbol
=
symbol
->
next
())
{
if
(
!
opId
->
isEqualTo
(
symbol
->
name
()))
continue
;
if
(
!
candidates
.
contains
(
symbol
))
candidates
.
append
(
symbol
);
}
}
return
candidates
;
}
QList
<
Symbol
*>
LookupContext
::
resolve
(
Name
*
name
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
{
QList
<
Symbol
*>
candidates
;
if
(
!
name
)
return
candidates
;
return
candidates
;
// nothing to do, the symbol is anonymous.
if
(
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
else
if
(
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
return
resolveQualifiedNameId
(
q
,
visibleScopes
,
mode
);
if
(
Identifier
*
id
=
identifier
(
name
))
{
else
if
(
OperatorNameId
*
opId
=
name
->
asOperatorNameId
())
return
resolveOperatorNameId
(
opId
,
visibleScopes
,
mode
);
else
if
(
Identifier
*
id
=
identifier
(
name
))
{
for
(
int
scopeIndex
=
0
;
scopeIndex
<
visibleScopes
.
size
();
++
scopeIndex
)
{
Scope
*
scope
=
visibleScopes
.
at
(
scopeIndex
);
for
(
Symbol
*
symbol
=
scope
->
lookat
(
id
);
symbol
;
symbol
=
symbol
->
next
())
{
if
(
!
symbol
->
name
())
{
continue
;
...
...
@@ -237,16 +262,6 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
candidates
.
append
(
symbol
);
}
}
}
else
if
(
OperatorNameId
*
opId
=
name
->
asOperatorNameId
())
{
for
(
int
scopeIndex
=
0
;
scopeIndex
<
visibleScopes
.
size
();
++
scopeIndex
)
{
Scope
*
scope
=
visibleScopes
.
at
(
scopeIndex
);
for
(
Symbol
*
symbol
=
scope
->
lookat
(
opId
->
kind
());
symbol
;
symbol
=
symbol
->
next
())
{
if
(
!
opId
->
isEqualTo
(
symbol
->
name
()))
continue
;
else
if
(
!
candidates
.
contains
(
symbol
))
candidates
.
append
(
symbol
);
}
}
}
return
candidates
;
...
...
src/libs/cplusplus/LookupContext.h
View file @
faaab90a
...
...
@@ -119,6 +119,10 @@ private:
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
;
QList
<
Symbol
*>
resolveOperatorNameId
(
OperatorNameId
*
opId
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
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