Ignore:
Timestamp:
Jul 12, 2019, 4:34:56 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e3d7f9f
Parents:
8fd52e90
Message:

Resolver now uses constant interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Visitor.h

    r8fd52e90 r6f096d2  
    222222
    223223template< typename TreeType, typename VisitorType >
    224 inline void maybeAccept( TreeType *tree, VisitorType &visitor ) {
     224inline void maybeAccept( TreeType * tree, VisitorType & visitor ) {
    225225        if ( tree ) {
    226226                tree->accept( visitor );
     
    228228}
    229229
     230template< typename TreeType, typename VisitorType >
     231inline void maybeAccept( const TreeType * tree, VisitorType & visitor ) {
     232        if ( tree ) {
     233                tree->accept( visitor );
     234        }
     235}
     236
    230237template< typename Container, typename VisitorType >
    231 inline void acceptAll( Container &container, VisitorType &visitor ) {
     238inline void acceptAll( Container & container, VisitorType & visitor ) {
    232239        SemanticErrorException errors;
    233         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
     240        for ( const auto * i : container ) {
    234241                try {
    235                         if ( *i ) {
    236                                 (*i)->accept( visitor );
     242                        if ( i ) {
     243                                i->accept( visitor );
     244                        }
     245                } catch( SemanticErrorException & e ) {
     246                        errors.append( e );
     247                }
     248        }
     249        if ( ! errors.isEmpty() ) {
     250                throw errors;
     251        }
     252}
     253
     254template< typename Container, typename VisitorType >
     255inline void acceptAll( const Container & container, VisitorType & visitor ) {
     256        SemanticErrorException errors;
     257        for ( const auto * i : container ) {
     258                try {
     259                        if ( i ) {
     260                                i->accept( visitor );
    237261                        }
    238262                } catch( SemanticErrorException &e ) {
Note: See TracChangeset for help on using the changeset viewer.