summaryrefslogtreecommitdiff
path: root/shared/cplusplus/AST.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <qtc-committer@nokia.com>2009-01-06 11:55:41 +0100
committerRoberto Raggi <qtc-committer@nokia.com>2009-01-06 12:15:50 +0100
commitc187d71cb05a6f829e2fcecc3dbd57be58dc12a4 (patch)
tree4fac263d0ab9fa4ac13ed4a5a87aa4110a738ef1 /shared/cplusplus/AST.cpp
parent9666488fbe46cdf3a9b834cfaa3a21d28b42aad2 (diff)
downloadqt-creator-c187d71cb05a6f829e2fcecc3dbd57be58dc12a4.tar.gz
TemplateDeclarationAST::lastToken().
Diffstat (limited to 'shared/cplusplus/AST.cpp')
-rw-r--r--shared/cplusplus/AST.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/shared/cplusplus/AST.cpp b/shared/cplusplus/AST.cpp
index ad0c65c6c2..d30e6c14a1 100644
--- a/shared/cplusplus/AST.cpp
+++ b/shared/cplusplus/AST.cpp
@@ -2375,7 +2375,7 @@ unsigned TemplateArgumentListAST::firstToken() const
unsigned TemplateArgumentListAST::lastToken() const
{
- for (TemplateArgumentListAST *it = this; it; it = it->next) {
+ for (const TemplateArgumentListAST *it = this; it; it = it->next) {
if (! it->next && it->template_argument)
return it->template_argument->lastToken();
}
@@ -2401,10 +2401,24 @@ unsigned TemplateDeclarationAST::firstToken() const
unsigned TemplateDeclarationAST::lastToken() const
{
- assert(0 && "review me");
if (declaration)
return declaration->lastToken();
- return greater_token + 1;
+ else if (greater_token)
+ return greater_token + 1;
+
+ for (DeclarationAST *it = template_parameters; it; it = it->next) {
+ if (! it->next)
+ return it->lastToken();
+ }
+
+ if (less_token)
+ return less_token + 1;
+ else if (template_token)
+ return template_token + 1;
+ else if (export_token)
+ return export_token + 1;
+
+ return 0;
}
void TemplateIdAST::accept0(ASTVisitor *visitor)