Changeset 6f096d2 for src/SynTree/Visitor.h
- Timestamp:
- Jul 12, 2019, 4:34:56 PM (4 years ago)
- Branches:
- ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- e3d7f9f
- Parents:
- 8fd52e9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Visitor.h
r8fd52e9 r6f096d2 222 222 223 223 template< typename TreeType, typename VisitorType > 224 inline void maybeAccept( TreeType * tree, VisitorType &visitor ) {224 inline void maybeAccept( TreeType * tree, VisitorType & visitor ) { 225 225 if ( tree ) { 226 226 tree->accept( visitor ); … … 228 228 } 229 229 230 template< typename TreeType, typename VisitorType > 231 inline void maybeAccept( const TreeType * tree, VisitorType & visitor ) { 232 if ( tree ) { 233 tree->accept( visitor ); 234 } 235 } 236 230 237 template< typename Container, typename VisitorType > 231 inline void acceptAll( Container & container, VisitorType &visitor ) {238 inline void acceptAll( Container & container, VisitorType & visitor ) { 232 239 SemanticErrorException errors; 233 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i) {240 for ( const auto * i : container ) { 234 241 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 254 template< typename Container, typename VisitorType > 255 inline 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 ); 237 261 } 238 262 } catch( SemanticErrorException &e ) {
Note: See TracChangeset
for help on using the changeset viewer.