Changes in src/Common/PassVisitor.impl.h [3c398b6:5ea7a22]
- File:
-
- 1 edited
-
src/Common/PassVisitor.impl.h (modified) (110 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
r3c398b6 r5ea7a22 2 2 // IWYU pragma: private, include "PassVisitor.h" 3 3 4 #define VISIT_START( node ) \ 5 __attribute__((unused)) \ 6 ChildrenGuard children_guard( get_visit_children_ptr() ); \ 7 __attribute__((unused)) \ 4 #define VISIT_START( node ) \ 5 __attribute__((unused)) \ 8 6 guard_value_impl guard( at_cleanup_impl(pass, 0) ); \ 9 call_previsit( node ); \ 7 bool visit_children = true; \ 8 set_visit_children( visit_children ); \ 9 call_previsit( node ); \ 10 if( visit_children ) { \ 10 11 11 12 #define VISIT_END( node ) \ 13 } \ 12 14 call_postvisit( node ); \ 13 15 14 #define MUTATE_START( node ) \ 15 __attribute__((unused)) \ 16 ChildrenGuard children_guard( get_visit_children_ptr() ); \ 17 __attribute__((unused)) \ 16 #define MUTATE_START( node ) \ 17 __attribute__((unused)) \ 18 18 guard_value_impl guard( at_cleanup_impl(pass, 0) ); \ 19 call_premutate( node ); \ 19 bool visit_children = true; \ 20 set_visit_children( visit_children ); \ 21 call_premutate( node ); \ 22 if( visit_children ) { \ 20 23 21 24 #define MUTATE_END( type, node ) \ 25 } \ 22 26 return call_postmutate< type * >( node ); \ 23 27 24 28 25 #define VISIT_BODY( node ) \ 26 VISIT_START( node ); \ 27 if( children_guard ) { \ 28 Visitor::visit( node ); \ 29 } \ 30 VISIT_END( node ); \ 31 32 33 #define MUTATE_BODY( type, node ) \ 34 MUTATE_START( node ); \ 35 if( children_guard ) { \ 36 Mutator::mutate( node ); \ 37 } \ 38 MUTATE_END( type, node ); \ 29 #define VISIT_BODY( node ) \ 30 VISIT_START( node ); \ 31 Visitor::visit( node ); \ 32 VISIT_END( node ); \ 33 34 35 #define MUTATE_BODY( type, node ) \ 36 MUTATE_START( node ); \ 37 Mutator::mutate( node ); \ 38 MUTATE_END( type, node ); \ 39 39 40 40 … … 63 63 template< typename pass_type > 64 64 static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) { 65 65 66 DeclList_t* beforeDecls = visitor.get_beforeDecls(); 66 67 DeclList_t* afterDecls = visitor.get_afterDecls(); … … 75 76 try { 76 77 // run visitor on declaration 77 maybeAccept _impl( *i, visitor );78 maybeAccept( *i, visitor ); 78 79 } catch( SemanticError &e ) { 79 80 e.set_location( (*i)->location ); … … 91 92 template< typename pass_type > 92 93 static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) { 94 93 95 DeclList_t* beforeDecls = mutator.get_beforeDecls(); 94 96 DeclList_t* afterDecls = mutator.get_afterDecls(); … … 102 104 try { 103 105 // run mutator on declaration 104 maybeMutate_impl( *i, mutator );106 *i = maybeMutate( *i, mutator ); 105 107 } catch( SemanticError &e ) { 106 108 e.set_location( (*i)->location ); … … 116 118 } 117 119 118 template< typename TreeType, typename pass_type > 119 inline void maybeAccept_impl( TreeType * tree, PassVisitor< pass_type > & visitor ) { 120 if ( ! visitor.get_visit_children() ) return; 121 if ( tree ) { 122 tree->accept( visitor ); 123 } 124 } 125 126 template< typename Container, typename pass_type > 127 inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) { 128 if ( ! visitor.get_visit_children() ) return; 120 template< typename Container, typename VisitorType > 121 inline void maybeAccept( Container &container, VisitorType &visitor ) { 129 122 SemanticError errors; 130 123 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { … … 143 136 } 144 137 145 template< typename TreeType, typename pass_type > 146 inline void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_type > & mutator ) { 147 if ( ! mutator.get_visit_children() ) return; 148 149 if ( tree ) { 150 tree = strict_dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) ); 151 } 152 } 153 154 template< typename Container, typename pass_type > 155 inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) { 156 if ( ! mutator.get_visit_children() ) return; 138 template< typename Container, typename MutatorType > 139 inline void maybeMutateRef( Container &container, MutatorType &mutator ) { 157 140 SemanticError errors; 158 141 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { 159 142 try { 160 143 if ( *i ) { 144 /// *i = (*i)->acceptMutator( mutator ); 161 145 *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) ); 162 146 assert( *i ); … … 175 159 template< typename func_t > 176 160 void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) { 177 if ( ! get_visit_children() ) return;178 161 SemanticError errors; 179 162 … … 216 199 void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) { 217 200 handleStatementList( statements, [this]( Statement * stmt) { 218 maybeAccept_impl( stmt,*this );201 stmt->accept( *this ); 219 202 }); 220 203 } … … 223 206 void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) { 224 207 handleStatementList( statements, [this]( Statement *& stmt) { 225 maybeMutate_impl( stmt,*this );208 stmt = stmt->acceptMutator( *this ); 226 209 }); 227 210 } … … 231 214 template< typename func_t > 232 215 Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) { 233 if ( ! get_visit_children() ) return stmt;234 235 216 // don't want statements from outer CompoundStmts to be added to this CompoundStmt 236 217 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr () ); … … 263 244 Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) { 264 245 return handleStatement( stmt, [this]( Statement * stmt ) { 265 maybeAccept _impl( stmt, *this );246 maybeAccept( stmt, *this ); 266 247 return stmt; 267 248 }); … … 271 252 Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) { 272 253 return handleStatement( stmt, [this]( Statement * stmt ) { 273 maybeMutate_impl( stmt, *this ); 274 return stmt; 254 return maybeMutate( stmt, *this ); 275 255 }); 276 256 } … … 279 259 template< typename func_t > 280 260 Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) { 281 if ( ! get_visit_children() ) return expr;282 261 if( !expr ) return nullptr; 283 262 … … 287 266 } 288 267 289 // should env be movedonto the result of the mutate?268 // should env be cloned (or moved) onto the result of the mutate? 290 269 return func( expr ); 291 270 } … … 294 273 Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) { 295 274 return handleExpression(expr, [this]( Expression * expr ) { 296 maybeAccept_impl( expr,*this );275 expr->accept( *this ); 297 276 return expr; 298 277 }); … … 302 281 Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) { 303 282 return handleExpression(expr, [this]( Expression * expr ) { 304 maybeMutate_impl( expr, *this ); 305 return expr; 283 return expr->acceptMutator( *this ); 306 284 }); 307 }308 309 template< typename TreeType, typename VisitorType >310 inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {311 if ( ! visitor.get_visit_children() ) return;312 auto guard = makeFuncGuard(313 [&visitor]() { visitor.indexerScopeEnter(); },314 [&visitor]() { visitor.indexerScopeLeave(); }315 );316 maybeAccept_impl( tree, visitor );317 }318 319 template< typename TreeType, typename MutatorType >320 inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) {321 if ( ! mutator.get_visit_children() ) return;322 auto guard = makeFuncGuard(323 [&mutator]() { mutator.indexerScopeEnter(); },324 [&mutator]() { mutator.indexerScopeLeave(); }325 );326 maybeMutate_impl( tree, mutator );327 285 } 328 286 … … 361 319 362 320 indexerScopedAccept( node->type , *this ); 363 maybeAccept _impl( node->init , *this );364 maybeAccept _impl( node->bitfieldWidth, *this );365 maybeAccept _impl( node->attributes , *this );321 maybeAccept ( node->init , *this ); 322 maybeAccept ( node->bitfieldWidth, *this ); 323 maybeAccept ( node->attributes , *this ); 366 324 367 325 if ( node->name != "" ) { … … 377 335 378 336 indexerScopedMutate( node->type , *this ); 379 maybeMutate _impl( node->init , *this );380 maybeMutate _impl( node->bitfieldWidth, *this );381 maybeMutate _impl( node->attributes , *this );337 maybeMutateRef ( node->init , *this ); 338 maybeMutateRef ( node->bitfieldWidth, *this ); 339 maybeMutateRef ( node->attributes , *this ); 382 340 383 341 if ( node->name != "" ) { … … 400 358 { 401 359 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 402 maybeAccept _impl( node->type, *this );403 maybeAccept _impl( node->statements, *this );404 maybeAccept _impl( node->attributes, *this );360 maybeAccept( node->type, *this ); 361 maybeAccept( node->statements, *this ); 362 maybeAccept( node->attributes, *this ); 405 363 } 406 364 … … 418 376 { 419 377 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 420 maybeMutate _impl( node->type, *this );421 maybeMutate _impl( node->statements, *this );422 maybeMutate _impl( node->attributes, *this );378 maybeMutateRef( node->type, *this ); 379 maybeMutateRef( node->statements, *this ); 380 maybeMutateRef( node->attributes, *this ); 423 381 } 424 382 … … 438 396 { 439 397 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 440 maybeAccept _impl( node->parameters, *this );441 maybeAccept _impl( node->members , *this );398 maybeAccept( node->parameters, *this ); 399 maybeAccept( node->members , *this ); 442 400 } 443 401 … … 458 416 { 459 417 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 460 maybeMutate _impl( node->parameters, *this );461 maybeMutate _impl( node->members , *this );418 maybeMutateRef( node->parameters, *this ); 419 maybeMutateRef( node->members , *this ); 462 420 } 463 421 … … 479 437 { 480 438 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 481 maybeAccept _impl( node->parameters, *this );482 maybeAccept _impl( node->members , *this );439 maybeAccept( node->parameters, *this ); 440 maybeAccept( node->members , *this ); 483 441 } 484 442 … … 497 455 { 498 456 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 499 maybeMutate _impl( node->parameters, *this );500 maybeMutate _impl( node->members , *this );457 maybeMutateRef( node->parameters, *this ); 458 maybeMutateRef( node->members , *this ); 501 459 } 502 460 … … 515 473 516 474 // unlike structs, traits, and unions, enums inject their members into the global scope 517 maybeAccept _impl( node->parameters, *this );518 maybeAccept _impl( node->members , *this );475 maybeAccept( node->parameters, *this ); 476 maybeAccept( node->members , *this ); 519 477 520 478 VISIT_END( node ); … … 528 486 529 487 // unlike structs, traits, and unions, enums inject their members into the global scope 530 maybeMutate _impl( node->parameters, *this );531 maybeMutate _impl( node->members , *this );488 maybeMutateRef( node->parameters, *this ); 489 maybeMutateRef( node->members , *this ); 532 490 533 491 MUTATE_END( Declaration, node ); … … 542 500 { 543 501 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 544 maybeAccept _impl( node->parameters, *this );545 maybeAccept _impl( node->members , *this );502 maybeAccept( node->parameters, *this ); 503 maybeAccept( node->members , *this ); 546 504 } 547 505 … … 557 515 { 558 516 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 559 maybeMutate _impl( node->parameters, *this );560 maybeMutate _impl( node->members , *this );517 maybeMutateRef( node->parameters, *this ); 518 maybeMutateRef( node->members , *this ); 561 519 } 562 520 … … 574 532 { 575 533 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 576 maybeAccept _impl( node->parameters, *this );577 maybeAccept _impl( node->base , *this );534 maybeAccept( node->parameters, *this ); 535 maybeAccept( node->base , *this ); 578 536 } 579 537 … … 583 541 indexerAddType( node ); 584 542 585 maybeAccept _impl( node->assertions, *this );543 maybeAccept( node->assertions, *this ); 586 544 587 545 indexerScopedAccept( node->init, *this ); … … 596 554 { 597 555 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 598 maybeMutate _impl( node->parameters, *this );599 maybeMutate _impl( node->base , *this );556 maybeMutateRef( node->parameters, *this ); 557 maybeMutateRef( node->base , *this ); 600 558 } 601 559 … … 605 563 indexerAddType( node ); 606 564 607 maybeMutate _impl( node->assertions, *this );565 maybeMutateRef( node->assertions, *this ); 608 566 609 567 indexerScopedMutate( node->init, *this ); … … 620 578 { 621 579 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 622 maybeAccept _impl( node->parameters, *this );623 maybeAccept _impl( node->base , *this );580 maybeAccept( node->parameters, *this ); 581 maybeAccept( node->base , *this ); 624 582 } 625 583 626 584 indexerAddType( node ); 627 585 628 maybeAccept _impl( node->assertions, *this );586 maybeAccept( node->assertions, *this ); 629 587 630 588 VISIT_END( node ); … … 637 595 { 638 596 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 639 maybeMutate _impl( node->parameters, *this );640 maybeMutate _impl( node->base , *this );597 maybeMutateRef ( node->parameters, *this ); 598 maybeMutateRef( node->base , *this ); 641 599 } 642 600 643 601 indexerAddType( node ); 644 602 645 maybeMutate _impl( node->assertions, *this );603 maybeMutateRef( node->assertions, *this ); 646 604 647 605 MUTATE_END( Declaration, node ); … … 654 612 VISIT_START( node ); 655 613 656 maybeAccept _impl( node->stmt, *this );614 maybeAccept( node->stmt, *this ); 657 615 658 616 VISIT_END( node ); … … 663 621 MUTATE_START( node ); 664 622 665 maybeMutate _impl( node->stmt, *this );623 maybeMutateRef( node->stmt, *this ); 666 624 667 625 MUTATE_END( AsmDecl, node ); … … 732 690 // if statements introduce a level of scope (for the initialization) 733 691 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 734 maybeAccept_impl( node->get_initialization(), *this );735 visitExpression ( node->condition );692 acceptAll( node->get_initialization(), *this ); 693 visitExpression( node->condition ); 736 694 node->thenPart = visitStatement( node->thenPart ); 737 695 node->elsePart = visitStatement( node->elsePart ); … … 746 704 // if statements introduce a level of scope (for the initialization) 747 705 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 748 maybeMutate _impl( node->get_initialization(), *this );706 maybeMutateRef( node->get_initialization(), *this ); 749 707 node->condition = mutateExpression( node->condition ); 750 708 node->thenPart = mutateStatement ( node->thenPart ); … … 784 742 // for statements introduce a level of scope (for the initialization) 785 743 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 786 maybeAccept _impl( node->initialization, *this );744 maybeAccept( node->initialization, *this ); 787 745 visitExpression( node->condition ); 788 746 visitExpression( node->increment ); … … 798 756 // for statements introduce a level of scope (for the initialization) 799 757 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 800 maybeMutate _impl( node->initialization, *this );758 maybeMutateRef( node->initialization, *this ); 801 759 node->condition = mutateExpression( node->condition ); 802 760 node->increment = mutateExpression( node->increment ); … … 901 859 VISIT_START( node ); 902 860 903 maybeAccept _impl( node->block , *this );904 maybeAccept _impl( node->handlers , *this );905 maybeAccept _impl( node->finallyBlock, *this );861 maybeAccept( node->block , *this ); 862 maybeAccept( node->handlers , *this ); 863 maybeAccept( node->finallyBlock, *this ); 906 864 907 865 VISIT_END( node ); … … 912 870 MUTATE_START( node ); 913 871 914 maybeMutate _impl( node->block , *this );915 maybeMutate _impl( node->handlers , *this );916 maybeMutate _impl( node->finallyBlock, *this );872 maybeMutateRef( node->block , *this ); 873 maybeMutateRef( node->handlers , *this ); 874 maybeMutateRef( node->finallyBlock, *this ); 917 875 918 876 MUTATE_END( Statement, node ); … … 927 885 // catch statements introduce a level of scope (for the caught exception) 928 886 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 929 maybeAccept _impl( node->decl, *this );887 maybeAccept( node->decl, *this ); 930 888 node->cond = visitExpression( node->cond ); 931 889 node->body = visitStatement ( node->body ); … … 940 898 // catch statements introduce a level of scope (for the caught exception) 941 899 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 942 maybeMutate _impl( node->decl, *this );900 maybeMutateRef( node->decl, *this ); 943 901 node->cond = mutateExpression( node->cond ); 944 902 node->body = mutateStatement ( node->body ); … … 1014 972 1015 973 indexerScopedAccept( node->result , *this ); 1016 maybeAccept _impl( node->function, *this );1017 maybeAccept _impl( node->args , *this );974 maybeAccept ( node->function, *this ); 975 maybeAccept ( node->args , *this ); 1018 976 1019 977 VISIT_END( node ); … … 1026 984 indexerScopedMutate( node->env , *this ); 1027 985 indexerScopedMutate( node->result , *this ); 1028 maybeMutate _impl( node->function, *this );1029 maybeMutate _impl( node->args , *this );986 maybeMutateRef ( node->function, *this ); 987 maybeMutateRef ( node->args , *this ); 1030 988 1031 989 MUTATE_END( Expression, node ); … … 1038 996 VISIT_START( node ); 1039 997 1040 // maybeAccept _impl( node->get_env(), *this );998 // maybeAccept( node->get_env(), *this ); 1041 999 indexerScopedAccept( node->result, *this ); 1042 1000 … … 1090 1048 1091 1049 indexerScopedAccept( node->result, *this ); 1092 maybeAccept _impl( node->arg , *this );1050 maybeAccept ( node->arg , *this ); 1093 1051 1094 1052 VISIT_END( node ); … … 1101 1059 indexerScopedMutate( node->env , *this ); 1102 1060 indexerScopedMutate( node->result, *this ); 1103 maybeMutate _impl( node->arg , *this );1061 maybeMutateRef ( node->arg , *this ); 1104 1062 1105 1063 MUTATE_END( Expression, node ); … … 1113 1071 1114 1072 indexerScopedAccept( node->result, *this ); 1115 maybeAccept _impl( node->arg, *this );1073 maybeAccept( node->arg, *this ); 1116 1074 1117 1075 VISIT_END( node ); … … 1124 1082 indexerScopedMutate( node->env , *this ); 1125 1083 indexerScopedMutate( node->result, *this ); 1126 maybeMutate _impl( node->arg , *this );1084 maybeMutateRef ( node->arg , *this ); 1127 1085 1128 1086 MUTATE_END( Expression, node ); … … 1136 1094 1137 1095 indexerScopedAccept( node->result, *this ); 1138 maybeAccept _impl( node->arg , *this );1096 maybeAccept ( node->arg , *this ); 1139 1097 1140 1098 VISIT_END( node ); … … 1147 1105 indexerScopedMutate( node->env , *this ); 1148 1106 indexerScopedMutate( node->result, *this ); 1149 maybeMutate _impl( node->arg , *this );1107 maybeMutateRef ( node->arg , *this ); 1150 1108 1151 1109 MUTATE_END( Expression, node ); … … 1180 1138 1181 1139 indexerScopedAccept( node->result , *this ); 1182 maybeAccept _impl( node->aggregate, *this );1183 maybeAccept _impl( node->member , *this );1140 maybeAccept ( node->aggregate, *this ); 1141 maybeAccept ( node->member , *this ); 1184 1142 1185 1143 VISIT_END( node ); … … 1192 1150 indexerScopedMutate( node->env , *this ); 1193 1151 indexerScopedMutate( node->result , *this ); 1194 maybeMutate _impl( node->aggregate, *this );1195 maybeMutate _impl( node->member , *this );1152 maybeMutateRef ( node->aggregate, *this ); 1153 maybeMutateRef ( node->member , *this ); 1196 1154 1197 1155 MUTATE_END( Expression, node ); … … 1205 1163 1206 1164 indexerScopedAccept( node->result , *this ); 1207 maybeAccept _impl( node->aggregate, *this );1165 maybeAccept ( node->aggregate, *this ); 1208 1166 1209 1167 VISIT_END( node ); … … 1216 1174 indexerScopedMutate( node->env , *this ); 1217 1175 indexerScopedMutate( node->result , *this ); 1218 maybeMutate _impl( node->aggregate, *this );1176 maybeMutateRef ( node->aggregate, *this ); 1219 1177 1220 1178 MUTATE_END( Expression, node ); … … 1249 1207 1250 1208 indexerScopedAccept( node->result , *this ); 1251 maybeAccept _impl( &node->constant, *this );1209 maybeAccept ( &node->constant, *this ); 1252 1210 1253 1211 VISIT_END( node ); … … 1260 1218 indexerScopedMutate( node->env , *this ); 1261 1219 indexerScopedMutate( node->result, *this ); 1262 Constant * ptr = &node->constant; 1263 maybeMutate_impl( ptr, *this ); 1264 node->constant = *ptr; 1220 node->constant = *maybeMutate( &node->constant, *this ); 1265 1221 1266 1222 MUTATE_END( Expression, node ); … … 1275 1231 indexerScopedAccept( node->result, *this ); 1276 1232 if ( node->get_isType() ) { 1277 maybeAccept _impl( node->type, *this );1233 maybeAccept( node->type, *this ); 1278 1234 } else { 1279 maybeAccept _impl( node->expr, *this );1235 maybeAccept( node->expr, *this ); 1280 1236 } 1281 1237 … … 1290 1246 indexerScopedMutate( node->result, *this ); 1291 1247 if ( node->get_isType() ) { 1292 maybeMutate _impl( node->type, *this );1248 maybeMutateRef( node->type, *this ); 1293 1249 } else { 1294 maybeMutate _impl( node->expr, *this );1250 maybeMutateRef( node->expr, *this ); 1295 1251 } 1296 1252 … … 1306 1262 indexerScopedAccept( node->result, *this ); 1307 1263 if ( node->get_isType() ) { 1308 maybeAccept _impl( node->type, *this );1264 maybeAccept( node->type, *this ); 1309 1265 } else { 1310 maybeAccept _impl( node->expr, *this );1266 maybeAccept( node->expr, *this ); 1311 1267 } 1312 1268 … … 1321 1277 indexerScopedMutate( node->result, *this ); 1322 1278 if ( node->get_isType() ) { 1323 maybeMutate _impl( node->type, *this );1279 maybeMutateRef( node->type, *this ); 1324 1280 } else { 1325 maybeMutate _impl( node->expr, *this );1281 maybeMutateRef( node->expr, *this ); 1326 1282 } 1327 1283 … … 1336 1292 1337 1293 indexerScopedAccept( node->result, *this ); 1338 maybeAccept _impl( node->type , *this );1294 maybeAccept ( node->type , *this ); 1339 1295 1340 1296 VISIT_END( node ); … … 1347 1303 indexerScopedMutate( node->env , *this ); 1348 1304 indexerScopedMutate( node->result, *this ); 1349 maybeMutate _impl( node->type , *this );1305 maybeMutateRef ( node->type , *this ); 1350 1306 1351 1307 MUTATE_END( Expression, node ); … … 1359 1315 1360 1316 indexerScopedAccept( node->result, *this ); 1361 maybeAccept _impl( node->type , *this );1362 maybeAccept _impl( node->member, *this );1317 maybeAccept ( node->type , *this ); 1318 maybeAccept ( node->member, *this ); 1363 1319 1364 1320 VISIT_END( node ); … … 1371 1327 indexerScopedMutate( node->env , *this ); 1372 1328 indexerScopedMutate( node->result, *this ); 1373 maybeMutate _impl( node->type , *this );1374 maybeMutate _impl( node->member, *this );1329 maybeMutateRef ( node->type , *this ); 1330 maybeMutateRef ( node->member, *this ); 1375 1331 1376 1332 MUTATE_END( Expression, node ); … … 1384 1340 1385 1341 indexerScopedAccept( node->result, *this ); 1386 maybeAccept _impl( node->type , *this );1342 maybeAccept ( node->type , *this ); 1387 1343 1388 1344 VISIT_END( node ); … … 1395 1351 indexerScopedMutate( node->env , *this ); 1396 1352 indexerScopedMutate( node->result, *this ); 1397 maybeMutate _impl( node->type , *this );1353 maybeMutateRef ( node->type , *this ); 1398 1354 1399 1355 MUTATE_END( Expression, node ); … … 1408 1364 indexerScopedAccept( node->result, *this ); 1409 1365 if ( node->get_isType() ) { 1410 maybeAccept _impl( node->type, *this );1366 maybeAccept( node->type, *this ); 1411 1367 } else { 1412 maybeAccept _impl( node->expr, *this );1368 maybeAccept( node->expr, *this ); 1413 1369 } 1414 1370 … … 1423 1379 indexerScopedMutate( node->result, *this ); 1424 1380 if ( node->get_isType() ) { 1425 maybeMutate _impl( node->type, *this );1381 maybeMutateRef( node->type, *this ); 1426 1382 } else { 1427 maybeMutate _impl( node->expr, *this );1383 maybeMutateRef( node->expr, *this ); 1428 1384 } 1429 1385 … … 1438 1394 1439 1395 indexerScopedAccept( node->result, *this ); 1440 maybeAccept _impl( node->arg1 , *this );1441 maybeAccept _impl( node->arg2 , *this );1396 maybeAccept ( node->arg1 , *this ); 1397 maybeAccept ( node->arg2 , *this ); 1442 1398 1443 1399 VISIT_END( node ); … … 1450 1406 indexerScopedMutate( node->env , *this ); 1451 1407 indexerScopedMutate( node->result, *this ); 1452 maybeMutate _impl( node->arg1 , *this );1453 maybeMutate _impl( node->arg2 , *this );1408 maybeMutateRef ( node->arg1 , *this ); 1409 maybeMutateRef ( node->arg2 , *this ); 1454 1410 1455 1411 MUTATE_END( Expression, node ); … … 1463 1419 1464 1420 indexerScopedAccept( node->result, *this ); 1465 maybeAccept _impl( node->arg1 , *this );1466 maybeAccept _impl( node->arg2 , *this );1467 maybeAccept _impl( node->arg3 , *this );1421 maybeAccept ( node->arg1 , *this ); 1422 maybeAccept ( node->arg2 , *this ); 1423 maybeAccept ( node->arg3 , *this ); 1468 1424 1469 1425 VISIT_END( node ); … … 1476 1432 indexerScopedMutate( node->env , *this ); 1477 1433 indexerScopedMutate( node->result, *this ); 1478 maybeMutate _impl( node->arg1 , *this );1479 maybeMutate _impl( node->arg2 , *this );1480 maybeMutate _impl( node->arg3 , *this );1434 maybeMutateRef ( node->arg1 , *this ); 1435 maybeMutateRef ( node->arg2 , *this ); 1436 maybeMutateRef ( node->arg3 , *this ); 1481 1437 1482 1438 MUTATE_END( Expression, node ); … … 1490 1446 1491 1447 indexerScopedAccept( node->result, *this ); 1492 maybeAccept _impl( node->arg1 , *this );1493 maybeAccept _impl( node->arg2 , *this );1448 maybeAccept ( node->arg1 , *this ); 1449 maybeAccept ( node->arg2 , *this ); 1494 1450 1495 1451 VISIT_END( node ); … … 1502 1458 indexerScopedMutate( node->env , *this ); 1503 1459 indexerScopedMutate( node->result, *this ); 1504 maybeMutate _impl( node->arg1 , *this );1505 maybeMutate _impl( node->arg2 , *this );1460 maybeMutateRef ( node->arg1 , *this ); 1461 maybeMutateRef ( node->arg2 , *this ); 1506 1462 1507 1463 MUTATE_END( Expression, node ); … … 1515 1471 1516 1472 indexerScopedAccept( node->result, *this ); 1517 maybeAccept _impl( node->type, *this );1473 maybeAccept ( node->type, *this ); 1518 1474 1519 1475 VISIT_END( node ); … … 1526 1482 indexerScopedMutate( node->env , *this ); 1527 1483 indexerScopedMutate( node->result, *this ); 1528 maybeMutate _impl( node->type , *this );1484 maybeMutateRef ( node->type , *this ); 1529 1485 1530 1486 MUTATE_END( Expression, node ); … … 1538 1494 1539 1495 indexerScopedAccept( node->result , *this ); 1540 maybeAccept _impl( node->inout , *this );1541 maybeAccept _impl( node->constraint, *this );1542 maybeAccept _impl( node->operand , *this );1496 maybeAccept ( node->inout , *this ); 1497 maybeAccept ( node->constraint, *this ); 1498 maybeAccept ( node->operand , *this ); 1543 1499 1544 1500 VISIT_END( node ); … … 1551 1507 indexerScopedMutate( node->env , *this ); 1552 1508 indexerScopedMutate( node->result , *this ); 1553 maybeMutate _impl( node->inout , *this );1554 maybeMutate _impl( node->constraint, *this );1555 maybeMutate _impl( node->operand , *this );1509 maybeMutateRef ( node->inout , *this ); 1510 maybeMutateRef ( node->constraint, *this ); 1511 maybeMutateRef ( node->operand , *this ); 1556 1512 1557 1513 MUTATE_END( Expression, node ); … … 1565 1521 1566 1522 indexerScopedAccept( node->result , *this ); 1567 maybeAccept _impl( node->callExpr , *this );1568 maybeAccept _impl( node->tempDecls , *this );1569 maybeAccept _impl( node->returnDecls, *this );1570 maybeAccept _impl( node->dtors , *this );1523 maybeAccept ( node->callExpr , *this ); 1524 maybeAccept ( node->tempDecls , *this ); 1525 maybeAccept ( node->returnDecls, *this ); 1526 maybeAccept ( node->dtors , *this ); 1571 1527 1572 1528 VISIT_END( node ); … … 1579 1535 indexerScopedMutate( node->env , *this ); 1580 1536 indexerScopedMutate( node->result , *this ); 1581 maybeMutate _impl( node->callExpr , *this );1582 maybeMutate _impl( node->tempDecls , *this );1583 maybeMutate _impl( node->returnDecls, *this );1584 maybeMutate _impl( node->dtors , *this );1537 maybeMutateRef ( node->callExpr , *this ); 1538 maybeMutateRef ( node->tempDecls , *this ); 1539 maybeMutateRef ( node->returnDecls, *this ); 1540 maybeMutateRef ( node->dtors , *this ); 1585 1541 1586 1542 MUTATE_END( Expression, node ); … … 1594 1550 1595 1551 indexerScopedAccept( node->result , *this ); 1596 maybeAccept _impl( node->callExpr, *this );1552 maybeAccept ( node->callExpr, *this ); 1597 1553 1598 1554 VISIT_END( node ); … … 1605 1561 indexerScopedMutate( node->env , *this ); 1606 1562 indexerScopedMutate( node->result , *this ); 1607 maybeMutate _impl( node->callExpr, *this );1563 maybeMutateRef ( node->callExpr, *this ); 1608 1564 1609 1565 MUTATE_END( Expression, node ); … … 1617 1573 1618 1574 indexerScopedAccept( node->result , *this ); 1619 maybeAccept _impl( node->initializer, *this );1575 maybeAccept ( node->initializer, *this ); 1620 1576 1621 1577 VISIT_END( node ); … … 1628 1584 indexerScopedMutate( node->env , *this ); 1629 1585 indexerScopedMutate( node->result , *this ); 1630 maybeMutate _impl( node->initializer, *this );1586 maybeMutateRef ( node->initializer, *this ); 1631 1587 1632 1588 MUTATE_END( Expression, node ); … … 1640 1596 1641 1597 indexerScopedAccept( node->result, *this ); 1642 maybeAccept _impl( node->low , *this );1643 maybeAccept _impl( node->high , *this );1598 maybeAccept ( node->low , *this ); 1599 maybeAccept ( node->high , *this ); 1644 1600 1645 1601 VISIT_END( node ); … … 1652 1608 indexerScopedMutate( node->env , *this ); 1653 1609 indexerScopedMutate( node->result, *this ); 1654 maybeMutate _impl( node->low , *this );1655 maybeMutate _impl( node->high , *this );1610 maybeMutateRef ( node->low , *this ); 1611 maybeMutateRef ( node->high , *this ); 1656 1612 1657 1613 MUTATE_END( Expression, node ); … … 1665 1621 1666 1622 indexerScopedAccept( node->result, *this ); 1667 maybeAccept _impl( node->exprs , *this );1623 maybeAccept ( node->exprs , *this ); 1668 1624 1669 1625 VISIT_END( node ); … … 1676 1632 indexerScopedMutate( node->env , *this ); 1677 1633 indexerScopedMutate( node->result, *this ); 1678 maybeMutate _impl( node->exprs , *this );1634 maybeMutateRef ( node->exprs , *this ); 1679 1635 1680 1636 MUTATE_END( Expression, node ); … … 1688 1644 1689 1645 indexerScopedAccept( node->result, *this ); 1690 maybeAccept _impl( node->exprs , *this );1646 maybeAccept ( node->exprs , *this ); 1691 1647 1692 1648 VISIT_END( node ); … … 1699 1655 indexerScopedMutate( node->env , *this ); 1700 1656 indexerScopedMutate( node->result, *this ); 1701 maybeMutate _impl( node->exprs , *this );1657 maybeMutateRef ( node->exprs , *this ); 1702 1658 1703 1659 MUTATE_END( Expression, node ); … … 1711 1667 1712 1668 indexerScopedAccept( node->result, *this ); 1713 maybeAccept _impl( node->tuple , *this );1669 maybeAccept ( node->tuple , *this ); 1714 1670 1715 1671 VISIT_END( node ); … … 1722 1678 indexerScopedMutate( node->env , *this ); 1723 1679 indexerScopedMutate( node->result, *this ); 1724 maybeMutate _impl( node->tuple , *this );1680 maybeMutateRef ( node->tuple , *this ); 1725 1681 1726 1682 MUTATE_END( Expression, node ); … … 1734 1690 1735 1691 indexerScopedAccept( node->result , *this ); 1736 maybeAccept _impl( node->stmtExpr, *this );1692 maybeAccept ( node->stmtExpr, *this ); 1737 1693 1738 1694 VISIT_END( node ); … … 1745 1701 indexerScopedMutate( node->env , *this ); 1746 1702 indexerScopedMutate( node->result , *this ); 1747 maybeMutate _impl( node->stmtExpr, *this );1703 maybeMutateRef ( node->stmtExpr, *this ); 1748 1704 1749 1705 MUTATE_END( Expression, node ); … … 1762 1718 1763 1719 indexerScopedAccept( node->result , *this ); 1764 maybeAccept _impl( node->statements , *this );1765 maybeAccept _impl( node->returnDecls, *this );1766 maybeAccept _impl( node->dtors , *this );1720 maybeAccept ( node->statements , *this ); 1721 maybeAccept ( node->returnDecls, *this ); 1722 maybeAccept ( node->dtors , *this ); 1767 1723 1768 1724 VISIT_END( node ); … … 1779 1735 1780 1736 indexerScopedMutate( node->result , *this ); 1781 maybeMutate _impl( node->statements , *this );1782 maybeMutate _impl( node->returnDecls, *this );1783 maybeMutate _impl( node->dtors , *this );1737 maybeMutateRef ( node->statements , *this ); 1738 maybeMutateRef ( node->returnDecls, *this ); 1739 maybeMutateRef ( node->dtors , *this ); 1784 1740 1785 1741 MUTATE_END( Expression, node ); … … 1793 1749 1794 1750 indexerScopedAccept( node->result, *this ); 1795 maybeAccept _impl( node->expr , *this );1751 maybeAccept ( node->expr , *this ); 1796 1752 1797 1753 VISIT_END( node ); … … 1804 1760 indexerScopedMutate( node->env , *this ); 1805 1761 indexerScopedMutate( node->result, *this ); 1806 maybeMutate _impl( node->expr , *this );1762 maybeMutateRef ( node->expr , *this ); 1807 1763 1808 1764 MUTATE_END( Expression, node ); … … 1849 1805 { 1850 1806 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1851 maybeAccept _impl( node->forall , *this );1852 maybeAccept _impl( node->parameters, *this );1807 maybeAccept( node->forall , *this ); 1808 maybeAccept( node->parameters, *this ); 1853 1809 } 1854 1810 … … 1864 1820 { 1865 1821 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1866 maybeMutate _impl( node->forall , *this );1867 maybeMutate _impl( node->parameters, *this );1822 maybeMutateRef( node->forall , *this ); 1823 maybeMutateRef( node->parameters, *this ); 1868 1824 } 1869 1825 … … 1881 1837 { 1882 1838 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1883 maybeAccept _impl( node->forall , *this );1884 maybeAccept _impl( node->parameters, *this );1839 maybeAccept( node->forall , *this ); 1840 maybeAccept( node->parameters, *this ); 1885 1841 } 1886 1842 … … 1896 1852 { 1897 1853 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1898 maybeMutate _impl( node->forall , *this );1899 maybeMutate _impl( node->parameters, *this );1854 maybeMutateRef( node->forall , *this ); 1855 maybeMutateRef( node->parameters, *this ); 1900 1856 } 1901 1857 … … 1921 1877 VISIT_START( node ); 1922 1878 1923 maybeAccept _impl( node->forall , *this );1924 maybeAccept _impl( node->parameters, *this );1879 maybeAccept( node->forall , *this ); 1880 maybeAccept( node->parameters, *this ); 1925 1881 1926 1882 VISIT_END( node ); … … 1931 1887 MUTATE_START( node ); 1932 1888 1933 maybeMutate _impl( node->forall , *this );1934 maybeMutate _impl( node->parameters, *this );1889 maybeMutateRef( node->forall , *this ); 1890 maybeMutateRef( node->parameters, *this ); 1935 1891 1936 1892 MUTATE_END( Type, node ); … … 1978 1934 VISIT_START( node ); 1979 1935 1980 maybeAccept _impl( node->get_designators(), *this );1936 maybeAccept( node->get_designators(), *this ); 1981 1937 1982 1938 VISIT_END( node ); … … 1987 1943 MUTATE_START( node ); 1988 1944 1989 maybeMutate _impl( node->get_designators(), *this );1945 maybeMutateRef( node->get_designators(), *this ); 1990 1946 1991 1947 MUTATE_END( Designation, node );
Note:
See TracChangeset
for help on using the changeset viewer.