From 4fc2ccf0c5af6d93b1edca95518043b84e342c67 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 10 Nov 2009 15:30:16 +0100 Subject: Cleanup ptr operators. --- src/shared/cplusplus/AST.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/shared/cplusplus/AST.cpp') diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 03531c481a..8785ad6f09 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -483,10 +483,8 @@ unsigned ConversionFunctionIdAST::firstToken() const unsigned ConversionFunctionIdAST::lastToken() const { - for (PtrOperatorAST *it = ptr_operators; it; it = it->next) { - if (! it->next) - return it->lastToken(); - } + if (ptr_operators) + return ptr_operators->lastToken(); for (SpecifierAST *it = type_specifier; it; it = it->next) { if (! it->next) @@ -566,10 +564,8 @@ unsigned DeclaratorAST::lastToken() const if (core_declarator) return core_declarator->lastToken(); - for (PtrOperatorAST *it = ptr_operators; it; it = it->next) { - if (! it->next) - return it->lastToken(); - } + if (ptr_operators) + return ptr_operators->lastToken(); for (SpecifierAST *it = attributes; it; it = it->next) { if (! it->next) @@ -1176,12 +1172,10 @@ unsigned NewTypeIdAST::lastToken() const if (new_array_declarators) return new_array_declarators->lastToken(); - for (PtrOperatorAST *it = ptr_operators; it; it = it->next) { - if (it->next) - return it->lastToken(); - } + else if (ptr_operators) + return ptr_operators->lastToken(); - if (type_specifier) + else if (type_specifier) return type_specifier->lastToken(); // ### assert? -- cgit v1.2.1