Commit 03854281 authored by Roberto Raggi's avatar Roberto Raggi

Accept the next-declarator in NewDeclaratorAST::accept() and implemented...

Accept the next-declarator in NewDeclaratorAST::accept() and implemented NewDeclarator::lastToken().
parent 38be5640
...@@ -1821,9 +1821,11 @@ void NewDeclaratorAST::accept0(ASTVisitor *visitor) ...@@ -1821,9 +1821,11 @@ void NewDeclaratorAST::accept0(ASTVisitor *visitor)
{ {
if (visitor->visit(this)) { if (visitor->visit(this)) {
for (PtrOperatorAST *ptr_op = ptr_operators; ptr_op; for (PtrOperatorAST *ptr_op = ptr_operators; ptr_op;
ptr_op = static_cast<PtrOperatorAST *>(ptr_op->next)) ptr_op = static_cast<PtrOperatorAST *>(ptr_op->next)) {
accept(ptr_op, visitor); accept(ptr_op, visitor);
// ### TODO accept the brackets }
accept(declarator, visitor);
} }
} }
...@@ -1834,10 +1836,14 @@ unsigned NewDeclaratorAST::firstToken() const ...@@ -1834,10 +1836,14 @@ unsigned NewDeclaratorAST::firstToken() const
unsigned NewDeclaratorAST::lastToken() const unsigned NewDeclaratorAST::lastToken() const
{ {
assert(0 && "review me");
if (declarator) if (declarator)
return declarator->lastToken(); return declarator->lastToken();
assert(0); // ### implement me
for (PtrOperatorAST *it = ptr_operators; it; it = it->next) {
if (! it->next)
return it->lastToken();
}
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment