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
Tobias Hunger
qt-creator
Commits
743e00f1
Commit
743e00f1
authored
May 19, 2009
by
Roberto Raggi
Browse files
Improved name substitution.
parent
4f3b2f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/ResolveExpression.cpp
View file @
743e00f1
...
...
@@ -42,6 +42,7 @@
#include <NameVisitor.h>
#include <QtCore/QList>
#include <QtCore/QVarLengthArray>
#include <QtCore/QtDebug>
using
namespace
CPlusPlus
;
...
...
@@ -68,13 +69,27 @@ public:
protected:
FullySpecifiedType
subst
(
Name
*
name
)
{
if
(
TemplateNameId
*
t
=
name
->
asTemplateNameId
())
{
QVarLengthArray
<
FullySpecifiedType
,
8
>
args
(
t
->
templateArgumentCount
());
for
(
unsigned
i
=
0
;
i
<
t
->
templateArgumentCount
();
++
i
)
args
[
i
]
=
subst
(
t
->
templateArgumentAt
(
i
));
TemplateNameId
*
n
=
_control
->
templateNameId
(
t
->
identifier
(),
args
.
data
(),
args
.
size
());
return
FullySpecifiedType
(
_control
->
namedType
(
n
));
}
else
if
(
name
->
isQualifiedNameId
())
{
// ### implement me
}
for
(
int
i
=
0
;
i
<
_substitution
.
size
();
++
i
)
{
const
QPair
<
Name
*
,
FullySpecifiedType
>
s
=
_substitution
.
at
(
i
);
if
(
name
->
isEqualTo
(
s
.
first
))
return
s
.
second
;
}
return
_control
->
namedType
(
name
);
return
FullySpecifiedType
(
_control
->
namedType
(
name
)
)
;
}
FullySpecifiedType
subst
(
const
FullySpecifiedType
&
ty
)
...
...
@@ -116,7 +131,10 @@ protected:
}
virtual
void
visit
(
NamedType
*
ty
)
{
_type
.
setType
(
subst
(
ty
->
name
()).
type
());
}
// ### merge the specifiers
{
Name
*
name
=
ty
->
name
();
_type
.
setType
(
subst
(
name
).
type
());
}
virtual
void
visit
(
Function
*
ty
)
{
...
...
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