Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    r7870799 r342146e1  
    8080
    8181template< typename pass_type >
    82 inline void acceptAll( const std::list< const Declaration * > & decls, PassVisitor< pass_type >& visitor ) {
    83         SemanticErrorException errors;
    84 
    85         pass_visitor_stats.depth++;
    86         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    87         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    88         for ( const Declaration * decl : decls ) {
    89                 try {
    90                         // run visitor on declaration
    91                         maybeAccept_impl( decl, visitor );
    92                 }
    93                 catch( SemanticErrorException &e ) {
    94                         errors.append( e );
    95                 }
    96         }
    97         pass_visitor_stats.depth--;
    98         if ( ! errors.isEmpty() ) {
    99                 throw errors;
    100         }
    101 }
    102 
    103 template< typename pass_type >
    10482inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
    10583        DeclList_t* beforeDecls = mutator.get_beforeDecls();
     
    139117}
    140118
    141 template< typename TreeType, typename pass_type >
    142 inline void maybeAccept_impl( const TreeType * tree, PassVisitor< pass_type > & visitor ) {
    143         if ( ! visitor.get_visit_children() ) return;
    144         if ( tree ) {
    145                 tree->accept( visitor );
    146         }
    147 }
    148 
    149119template< typename Container, typename pass_type >
    150120inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) {
     
    159129                        if ( *i ) {
    160130                                (*i)->accept( visitor );
    161                         }
    162                 } catch( SemanticErrorException &e ) {
    163                         errors.append( e );
    164                 }
    165         }
    166         pass_visitor_stats.depth--;
    167         if ( ! errors.isEmpty() ) {
    168                 throw errors;
    169         }
    170 }
    171 
    172 template< typename Container, typename pass_type >
    173 inline void maybeAccept_impl( const Container & container, PassVisitor< pass_type > & visitor ) {
    174         if ( ! visitor.get_visit_children() ) return;
    175         SemanticErrorException errors;
    176 
    177         pass_visitor_stats.depth++;
    178         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    179         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    180         for ( const auto & i : container ) {
    181                 try {
    182                         if ( i ) {
    183                                 i->accept( visitor );
    184131                        }
    185132                } catch( SemanticErrorException &e ) {
     
    280227
    281228template< typename pass_type >
    282 void PassVisitor< pass_type >::visitStatementList( const std::list< Statement * > & statements ) {
    283         if ( ! get_visit_children() ) return;
    284         SemanticErrorException errors;
    285 
    286         pass_visitor_stats.depth++;
    287         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    288         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    289         for ( const Statement * i : statements ) {
    290                 try {
    291                         maybeAccept_impl( i, *this );
    292                 } catch ( SemanticErrorException &e ) {
    293                         errors.append( e );
    294                 }
    295         }
    296         pass_visitor_stats.depth--;
    297         if ( !errors.isEmpty() ) { throw errors; }
    298 }
    299 
    300 template< typename pass_type >
    301229void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
    302230        handleStatementList( statements, [this]( Statement *& stmt) {
     
    347275
    348276template< typename pass_type >
    349 void PassVisitor< pass_type >::visitStatement( const Statement * stmt ) {
    350         if ( ! get_visit_children() ) return;
    351 
    352         // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    353         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    354 
    355         maybeAccept_impl( stmt, *this );
    356 }
    357 
    358 template< typename pass_type >
    359277Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
    360278        return handleStatement( stmt, [this]( Statement * stmt ) {
     
    388306
    389307template< typename pass_type >
    390 void PassVisitor< pass_type >::visitExpression( const Expression * expr ) {
    391         if ( ! get_visit_children() ) return;
    392         if( !expr ) return;
    393 
    394         auto env_ptr = get_env_ptr();
    395         if ( env_ptr && expr->get_env() ) {
    396                 *env_ptr = expr->get_env();
    397         }
    398 
    399         maybeAccept_impl( expr, *this );
    400 }
    401 
    402 template< typename pass_type >
    403308Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
    404309        return handleExpression(expr, [this]( Expression * expr ) {
     
    410315template< typename TreeType, typename VisitorType >
    411316inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
    412         if ( ! visitor.get_visit_children() ) return;
    413         auto guard = makeFuncGuard(
    414                 [&visitor]() { visitor.indexerScopeEnter(); },
    415                 [&visitor]() { visitor.indexerScopeLeave(); }
    416         );
    417         maybeAccept_impl( tree, visitor );
    418 }
    419 
    420 template< typename TreeType, typename VisitorType >
    421 inline void indexerScopedAccept( const TreeType * tree, VisitorType & visitor ) {
    422317        if ( ! visitor.get_visit_children() ) return;
    423318        auto guard = makeFuncGuard(
     
    477372
    478373        indexerAddId( node );
    479 
    480         VISIT_END( node );
    481 }
    482 
    483 template< typename pass_type >
    484 void PassVisitor< pass_type >::visit( const ObjectDecl * node ) {
    485         VISIT_START( node );
    486 
    487         maybeAccept_impl( node->type         , *this );
    488         maybeAccept_impl( node->init         , *this );
    489         maybeAccept_impl( node->bitfieldWidth, *this );
    490         maybeAccept_impl( node->attributes   , *this );
    491374
    492375        VISIT_END( node );
     
    545428
    546429template< typename pass_type >
    547 void PassVisitor< pass_type >::visit( const FunctionDecl * node ) {
    548         VISIT_START( node );
    549 
    550         maybeAccept_impl( node->withExprs, *this );
    551         {
    552                 // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    553                 static ObjectDecl func(
    554                         "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    555                         new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    556                         nullptr
    557                 );
    558                 maybeAccept_impl( node->type, *this );
    559                 // function body needs to have the same scope as parameters - CompoundStmt will not enter
    560                 // a new scope if inFunction is true
    561                 ValueGuard< bool > oldInFunction( inFunction );
    562                 inFunction = true;
    563                 maybeAccept_impl( node->statements, *this );
    564                 maybeAccept_impl( node->attributes, *this );
    565         }
    566 
    567         VISIT_END( node );
    568 }
    569 
    570 template< typename pass_type >
    571430DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
    572431        MUTATE_START( node );
     
    625484
    626485template< typename pass_type >
    627 void PassVisitor< pass_type >::visit( const StructDecl * node ) {
    628         VISIT_START( node );
    629 
    630         maybeAccept_impl( node->parameters, *this );
    631         maybeAccept_impl( node->members   , *this );
    632 
    633         VISIT_END( node );
    634 }
    635 
    636 template< typename pass_type >
    637486Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
    638487        MUTATE_START( node );
     
    673522        VISIT_END( node );
    674523}
    675 template< typename pass_type >
    676 void PassVisitor< pass_type >::visit( const UnionDecl * node ) {
    677         VISIT_START( node );
    678 
    679         maybeAccept_impl( node->parameters, *this );
    680         maybeAccept_impl( node->members   , *this );
    681 
    682         VISIT_END( node );
    683 }
    684524
    685525template< typename pass_type >
     
    717557
    718558template< typename pass_type >
    719 void PassVisitor< pass_type >::visit( const EnumDecl * node ) {
    720         VISIT_START( node );
    721 
    722         // unlike structs, traits, and unions, enums inject their members into the global scope
    723         maybeAccept_impl( node->parameters, *this );
    724         maybeAccept_impl( node->members   , *this );
    725 
    726         VISIT_END( node );
    727 }
    728 
    729 template< typename pass_type >
    730559Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
    731560        MUTATE_START( node );
     
    758587
    759588template< typename pass_type >
    760 void PassVisitor< pass_type >::visit( const TraitDecl * node ) {
    761         VISIT_START( node );
    762 
    763         maybeAccept_impl( node->parameters, *this );
    764         maybeAccept_impl( node->members   , *this );
    765 
    766         VISIT_END( node );
    767 }
    768 
    769 template< typename pass_type >
    770589Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
    771590        MUTATE_START( node );
     
    806625}
    807626
    808 
    809 template< typename pass_type >
    810 void PassVisitor< pass_type >::visit( const TypeDecl * node ) {
    811         VISIT_START( node );
    812 
    813         maybeAccept_impl( node->parameters, *this );
    814         maybeAccept_impl( node->base      , *this );
    815         maybeAccept_impl( node->assertions, *this );
    816 
    817         VISIT_END( node );
    818 }
    819 
    820627template< typename pass_type >
    821628Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
     
    860667
    861668template< typename pass_type >
    862 void PassVisitor< pass_type >::visit( const TypedefDecl * node ) {
    863         VISIT_START( node );
    864 
    865         maybeAccept_impl( node->parameters, *this );
    866         maybeAccept_impl( node->base      , *this );
    867         maybeAccept_impl( node->assertions, *this );
    868 
    869         VISIT_END( node );
    870 }
    871 
    872 template< typename pass_type >
    873669Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
    874670        MUTATE_START( node );
     
    899695
    900696template< typename pass_type >
    901 void PassVisitor< pass_type >::visit( const AsmDecl * node ) {
    902         VISIT_START( node );
    903 
    904         maybeAccept_impl( node->stmt, *this );
    905 
    906         VISIT_END( node );
    907 }
    908 
    909 template< typename pass_type >
    910697AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
    911698        MUTATE_START( node );
     
    923710
    924711        node->condition = visitExpression( node->condition );
    925         maybeAccept_impl( node->message, *this );
    926 
    927         VISIT_END( node );
    928 }
    929 
    930 template< typename pass_type >
    931 void PassVisitor< pass_type >::visit( const StaticAssertDecl * node ) {
    932         VISIT_START( node );
    933 
    934         visitExpression( node->condition );
    935712        maybeAccept_impl( node->message, *this );
    936713
     
    965742
    966743template< typename pass_type >
    967 void PassVisitor< pass_type >::visit( const CompoundStmt * node ) {
    968         VISIT_START( node );
    969         {
    970                 // do not enter a new scope if inFunction is true - needs to check old state before the assignment
    971                 ValueGuard< bool > oldInFunction( inFunction );
    972                 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    973                 auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    974                 inFunction = false;
    975                 visitStatementList( node->kids );
    976         }
    977         VISIT_END( node );
    978 }
    979 
    980 template< typename pass_type >
    981744CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
    982745        MUTATE_START( node );
     
    1004767
    1005768template< typename pass_type >
    1006 void PassVisitor< pass_type >::visit( const ExprStmt * node ) {
    1007         VISIT_START( node );
    1008 
    1009         visitExpression( node->expr );
    1010 
    1011         VISIT_END( node );
    1012 }
    1013 
    1014 template< typename pass_type >
    1015769Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) {
    1016770        MUTATE_START( node );
     
    1036790
    1037791template< typename pass_type >
    1038 void PassVisitor< pass_type >::visit( const AsmStmt * node ) {
    1039         VISIT_START( node )
    1040 
    1041         maybeAccept_impl( node->instruction, *this );
    1042         maybeAccept_impl( node->output, *this );
    1043         maybeAccept_impl( node->input, *this );
    1044         maybeAccept_impl( node->clobber, *this );
    1045 
    1046         VISIT_END( node );
    1047 }
    1048 
    1049 template< typename pass_type >
    1050792Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    1051793        MUTATE_START( node );
     
    1069811
    1070812template< typename pass_type >
    1071 void PassVisitor< pass_type >::visit( const DirectiveStmt * node ) {
    1072         VISIT_START( node )
    1073 
    1074         VISIT_END( node );
    1075 }
    1076 
    1077 template< typename pass_type >
    1078813Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
    1079814        MUTATE_START( node );
     
    1090825                // if statements introduce a level of scope (for the initialization)
    1091826                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1092                 maybeAccept_impl( node->initialization, *this );
     827                maybeAccept_impl( node->get_initialization(), *this );
    1093828                visitExpression ( node->condition );
    1094829                node->thenPart = visitStatement( node->thenPart );
     
    1099834
    1100835template< typename pass_type >
    1101 void PassVisitor< pass_type >::visit( const IfStmt * node ) {
    1102         VISIT_START( node );
    1103 
    1104         maybeAccept_impl( node->initialization, *this );
    1105         visitExpression ( node->condition );
    1106         visitStatement( node->thenPart );
    1107         visitStatement( node->elsePart );
    1108 
    1109         VISIT_END( node );
    1110 }
    1111 
    1112 template< typename pass_type >
    1113836Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    1114837        MUTATE_START( node );
     
    1116839                // if statements introduce a level of scope (for the initialization)
    1117840                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1118                 maybeMutate_impl( node->initialization, *this );
     841                maybeMutate_impl( node->get_initialization(), *this );
    1119842                node->condition = mutateExpression( node->condition );
    1120843                node->thenPart  = mutateStatement ( node->thenPart  );
     
    1137860                node->body = visitStatement( node->body );
    1138861        }
    1139 
    1140         VISIT_END( node );
    1141 }
    1142 
    1143 template< typename pass_type >
    1144 void PassVisitor< pass_type >::visit( const WhileStmt * node ) {
    1145         VISIT_START( node );
    1146 
    1147         maybeAccept_impl( node->initialization, *this );
    1148         visitExpression ( node->condition );
    1149         visitStatement( node->body );
    1150862
    1151863        VISIT_END( node );
     
    1185897
    1186898template< typename pass_type >
    1187 void PassVisitor< pass_type >::visit( const ForStmt * node ) {
    1188         VISIT_START( node );
    1189 
    1190         maybeAccept_impl( node->initialization, *this );
    1191         visitExpression( node->condition );
    1192         visitExpression( node->increment );
    1193         visitStatement( node->body );
    1194 
    1195         VISIT_END( node );
    1196 }
    1197 
    1198 template< typename pass_type >
    1199899Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    1200900        MUTATE_START( node );
     
    1223923
    1224924template< typename pass_type >
    1225 void PassVisitor< pass_type >::visit( const SwitchStmt * node ) {
    1226         VISIT_START( node );
    1227 
    1228         visitExpression   ( node->condition  );
    1229         visitStatementList( node->statements );
    1230 
    1231         VISIT_END( node );
    1232 }
    1233 
    1234 template< typename pass_type >
    1235925Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
    1236926        MUTATE_START( node );
     
    1255945
    1256946template< typename pass_type >
    1257 void PassVisitor< pass_type >::visit( const CaseStmt * node ) {
    1258         VISIT_START( node );
    1259 
    1260         visitExpression   ( node->condition );
    1261         visitStatementList( node->stmts     );
    1262 
    1263         VISIT_END( node );
    1264 }
    1265 
    1266 template< typename pass_type >
    1267947Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
    1268948        MUTATE_START( node );
     
    1283963
    1284964template< typename pass_type >
    1285 void PassVisitor< pass_type >::visit( const BranchStmt * node ) {
    1286         VISIT_START( node );
    1287         VISIT_END( node );
    1288 }
    1289 
    1290 template< typename pass_type >
    1291965Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    1292966        MUTATE_START( node );
     
    1306980
    1307981template< typename pass_type >
    1308 void PassVisitor< pass_type >::visit( const ReturnStmt * node ) {
    1309         VISIT_START( node );
    1310 
    1311         visitExpression( node->expr );
    1312 
    1313         VISIT_END( node );
    1314 }
    1315 
    1316 template< typename pass_type >
    1317982Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
    1318983        MUTATE_START( node );
     
    1325990//--------------------------------------------------------------------------
    1326991// ThrowStmt
     992
    1327993template< typename pass_type >
    1328994void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
     
    13361002
    13371003template< typename pass_type >
    1338 void PassVisitor< pass_type >::visit( const ThrowStmt * node ) {
    1339         VISIT_START( node );
    1340 
    1341         maybeAccept_impl( node->expr, *this );
    1342         maybeAccept_impl( node->target, *this );
    1343 
    1344         VISIT_END( node );
    1345 }
    1346 
    1347 template< typename pass_type >
    13481004Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    13491005        MUTATE_START( node );
     
    13591015template< typename pass_type >
    13601016void PassVisitor< pass_type >::visit( TryStmt * node ) {
    1361         VISIT_START( node );
    1362 
    1363         maybeAccept_impl( node->block       , *this );
    1364         maybeAccept_impl( node->handlers    , *this );
    1365         maybeAccept_impl( node->finallyBlock, *this );
    1366 
    1367         VISIT_END( node );
    1368 }
    1369 
    1370 template< typename pass_type >
    1371 void PassVisitor< pass_type >::visit( const TryStmt * node ) {
    13721017        VISIT_START( node );
    13731018
     
    14061051
    14071052template< typename pass_type >
    1408 void PassVisitor< pass_type >::visit( const CatchStmt * node ) {
    1409         VISIT_START( node );
    1410 
    1411         maybeAccept_impl( node->decl, *this );
    1412         visitExpression( node->cond );
    1413         visitStatement ( node->body );
    1414 
    1415         VISIT_END( node );
    1416 }
    1417 
    1418 template< typename pass_type >
    14191053Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    14201054        MUTATE_START( node );
     
    14411075
    14421076template< typename pass_type >
    1443 void PassVisitor< pass_type >::visit( const FinallyStmt * node ) {
    1444         VISIT_START( node );
    1445 
    1446         maybeAccept_impl( node->block, *this );
    1447 
    1448         VISIT_END( node );
    1449 }
    1450 
    1451 template< typename pass_type >
    14521077Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    14531078        MUTATE_START( node );
     
    14821107
    14831108template< typename pass_type >
    1484 void PassVisitor< pass_type >::visit( const WaitForStmt * node ) {
    1485         VISIT_START( node );
    1486 
    1487         for( auto & clause : node->clauses ) {
    1488                 maybeAccept_impl( clause.target.function, *this );
    1489                 maybeAccept_impl( clause.target.arguments, *this );
    1490 
    1491                 maybeAccept_impl( clause.statement, *this );
    1492                 maybeAccept_impl( clause.condition, *this );
    1493         }
    1494 
    1495         maybeAccept_impl( node->timeout.time, *this );
    1496         maybeAccept_impl( node->timeout.statement, *this );
    1497         maybeAccept_impl( node->timeout.condition, *this );
    1498         maybeAccept_impl( node->orelse.statement, *this );
    1499         maybeAccept_impl( node->orelse.condition, *this );
    1500 
    1501         VISIT_END( node );
    1502 }
    1503 
    1504 template< typename pass_type >
    15051109Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
    15061110        MUTATE_START( node );
     
    15261130
    15271131//--------------------------------------------------------------------------
    1528 // WithStmt
     1132// NullStmt
    15291133template< typename pass_type >
    15301134void PassVisitor< pass_type >::visit( WithStmt * node ) {
     
    15411145
    15421146template< typename pass_type >
    1543 void PassVisitor< pass_type >::visit( const WithStmt * node ) {
    1544         VISIT_START( node );
    1545 
    1546         maybeAccept_impl( node->exprs, *this );
    1547         maybeAccept_impl( node->stmt, *this );
    1548 
    1549         VISIT_END( node );
    1550 }
    1551 
    1552 template< typename pass_type >
    15531147Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) {
    15541148        MUTATE_START( node );
     
    15721166
    15731167template< typename pass_type >
    1574 void PassVisitor< pass_type >::visit( const NullStmt * node ) {
    1575         VISIT_START( node );
    1576         VISIT_END( node );
    1577 }
    1578 
    1579 template< typename pass_type >
    15801168NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
    15811169        MUTATE_START( node );
     
    15951183
    15961184template< typename pass_type >
    1597 void PassVisitor< pass_type >::visit( const DeclStmt * node ) {
    1598         VISIT_START( node );
    1599 
    1600         maybeAccept_impl( node->decl, *this );
    1601 
    1602         VISIT_END( node );
    1603 }
    1604 
    1605 template< typename pass_type >
    16061185Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
    16071186        MUTATE_START( node );
     
    16161195template< typename pass_type >
    16171196void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
    1618         VISIT_START( node );
    1619 
    1620         maybeAccept_impl( node->callStmt, *this );
    1621 
    1622         VISIT_END( node );
    1623 }
    1624 
    1625 template< typename pass_type >
    1626 void PassVisitor< pass_type >::visit( const ImplicitCtorDtorStmt * node ) {
    16271197        VISIT_START( node );
    16281198
     
    16501220        maybeAccept_impl        ( node->function, *this );
    16511221        maybeAccept_impl        ( node->args    , *this );
    1652 
    1653         VISIT_END( node );
    1654 }
    1655 
    1656 template< typename pass_type >
    1657 void PassVisitor< pass_type >::visit( const ApplicationExpr * node ) {
    1658         VISIT_START( node );
    1659 
    1660         maybeAccept_impl( node->result  , *this );
    1661         maybeAccept_impl( node->function, *this );
    1662         maybeAccept_impl( node->args    , *this );
    16631222
    16641223        VISIT_END( node );
     
    16941253
    16951254template< typename pass_type >
    1696 void PassVisitor< pass_type >::visit( const UntypedExpr * node ) {
    1697         VISIT_START( node );
    1698 
    1699         maybeAccept_impl( node->result, *this );
    1700 
    1701         for ( auto expr : node->args ) {
    1702                 visitExpression( expr );
    1703         }
    1704 
    1705         VISIT_END( node );
    1706 }
    1707 
    1708 template< typename pass_type >
    17091255Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
    17101256        MUTATE_START( node );
     
    17321278
    17331279template< typename pass_type >
    1734 void PassVisitor< pass_type >::visit( const NameExpr * node ) {
    1735         VISIT_START( node );
    1736 
    1737         maybeAccept_impl( node->result, *this );
    1738 
    1739         VISIT_END( node );
    1740 }
    1741 
    1742 template< typename pass_type >
    17431280Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
    17441281        MUTATE_START( node );
     
    17631300
    17641301template< typename pass_type >
    1765 void PassVisitor< pass_type >::visit( const CastExpr * node ) {
    1766         VISIT_START( node );
    1767 
    1768         maybeAccept_impl( node->result, *this );
    1769         maybeAccept_impl( node->arg   , *this );
    1770 
    1771         VISIT_END( node );
    1772 }
    1773 
    1774 template< typename pass_type >
    17751302Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
    17761303        MUTATE_START( node );
     
    17961323
    17971324template< typename pass_type >
    1798 void PassVisitor< pass_type >::visit( const KeywordCastExpr * node ) {
    1799         VISIT_START( node );
    1800 
    1801         maybeAccept_impl( node->result, *this );
    1802         maybeAccept_impl( node->arg   , *this );
    1803 
    1804         VISIT_END( node );
    1805 }
    1806 
    1807 template< typename pass_type >
    18081325Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) {
    18091326        MUTATE_START( node );
     
    18291346
    18301347template< typename pass_type >
    1831 void PassVisitor< pass_type >::visit( const VirtualCastExpr * node ) {
    1832         VISIT_START( node );
    1833 
    1834         maybeAccept_impl( node->result, *this );
    1835         maybeAccept_impl( node->arg, *this );
    1836 
    1837         VISIT_END( node );
    1838 }
    1839 
    1840 template< typename pass_type >
    18411348Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
    18421349        MUTATE_START( node );
     
    18621369
    18631370template< typename pass_type >
    1864 void PassVisitor< pass_type >::visit( const AddressExpr * node ) {
    1865         VISIT_START( node );
    1866 
    1867         maybeAccept_impl( node->result, *this );
    1868         maybeAccept_impl( node->arg   , *this );
    1869 
    1870         VISIT_END( node );
    1871 }
    1872 
    1873 template< typename pass_type >
    18741371Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
    18751372        MUTATE_START( node );
     
    18891386
    18901387        indexerScopedAccept( node->result, *this );
    1891 
    1892         VISIT_END( node );
    1893 }
    1894 
    1895 template< typename pass_type >
    1896 void PassVisitor< pass_type >::visit( const LabelAddressExpr * node ) {
    1897         VISIT_START( node );
    1898 
    1899         maybeAccept_impl( node->result, *this );
    19001388
    19011389        VISIT_END( node );
     
    19211409        maybeAccept_impl   ( node->aggregate, *this );
    19221410        maybeAccept_impl   ( node->member   , *this );
    1923 
    1924         VISIT_END( node );
    1925 }
    1926 
    1927 template< typename pass_type >
    1928 void PassVisitor< pass_type >::visit( const UntypedMemberExpr * node ) {
    1929         VISIT_START( node );
    1930 
    1931         maybeAccept_impl( node->result   , *this );
    1932         maybeAccept_impl( node->aggregate, *this );
    1933         maybeAccept_impl( node->member   , *this );
    19341411
    19351412        VISIT_END( node );
     
    19611438
    19621439template< typename pass_type >
    1963 void PassVisitor< pass_type >::visit( const MemberExpr * node ) {
    1964         VISIT_START( node );
    1965 
    1966         maybeAccept_impl( node->result   , *this );
    1967         maybeAccept_impl( node->aggregate, *this );
    1968 
    1969         VISIT_END( node );
    1970 }
    1971 
    1972 template< typename pass_type >
    19731440Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
    19741441        MUTATE_START( node );
     
    19931460
    19941461template< typename pass_type >
    1995 void PassVisitor< pass_type >::visit( const VariableExpr * node ) {
    1996         VISIT_START( node );
    1997 
    1998         maybeAccept_impl( node->result, *this );
    1999 
    2000         VISIT_END( node );
    2001 }
    2002 
    2003 template< typename pass_type >
    20041462Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
    20051463        MUTATE_START( node );
     
    20191477        indexerScopedAccept( node->result   , *this );
    20201478        maybeAccept_impl   ( &node->constant, *this );
    2021 
    2022         VISIT_END( node );
    2023 }
    2024 
    2025 template< typename pass_type >
    2026 void PassVisitor< pass_type >::visit( const ConstantExpr * node ) {
    2027         VISIT_START( node );
    2028 
    2029         maybeAccept_impl( node->result   , *this );
    2030         maybeAccept_impl( &node->constant, *this );
    20311479
    20321480        VISIT_END( node );
     
    20631511
    20641512template< typename pass_type >
    2065 void PassVisitor< pass_type >::visit( const SizeofExpr * node ) {
    2066         VISIT_START( node );
    2067 
    2068         maybeAccept_impl( node->result, *this );
    2069         if ( node->get_isType() ) {
    2070                 maybeAccept_impl( node->type, *this );
    2071         } else {
    2072                 maybeAccept_impl( node->expr, *this );
    2073         }
    2074 
    2075         VISIT_END( node );
    2076 }
    2077 
    2078 template< typename pass_type >
    20791513Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
    20801514        MUTATE_START( node );
     
    21081542
    21091543template< typename pass_type >
    2110 void PassVisitor< pass_type >::visit( const AlignofExpr * node ) {
    2111         VISIT_START( node );
    2112 
    2113         maybeAccept_impl( node->result, *this );
    2114         if ( node->get_isType() ) {
    2115                 maybeAccept_impl( node->type, *this );
    2116         } else {
    2117                 maybeAccept_impl( node->expr, *this );
    2118         }
    2119 
    2120         VISIT_END( node );
    2121 }
    2122 
    2123 template< typename pass_type >
    21241544Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
    21251545        MUTATE_START( node );
     
    21491569
    21501570template< typename pass_type >
    2151 void PassVisitor< pass_type >::visit( const UntypedOffsetofExpr * node ) {
    2152         VISIT_START( node );
    2153 
    2154         maybeAccept_impl( node->result, *this );
    2155         maybeAccept_impl( node->type  , *this );
    2156 
    2157         VISIT_END( node );
    2158 }
    2159 
    2160 template< typename pass_type >
    21611571Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
    21621572        MUTATE_START( node );
     
    21821592
    21831593template< typename pass_type >
    2184 void PassVisitor< pass_type >::visit( const OffsetofExpr * node ) {
    2185         VISIT_START( node );
    2186 
    2187         maybeAccept_impl( node->result, *this );
    2188         maybeAccept_impl( node->type  , *this );
    2189 
    2190         VISIT_END( node );
    2191 }
    2192 
    2193 template< typename pass_type >
    21941594Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
    21951595        MUTATE_START( node );
     
    22101610        indexerScopedAccept( node->result, *this );
    22111611        maybeAccept_impl   ( node->type  , *this );
    2212 
    2213         VISIT_END( node );
    2214 }
    2215 
    2216 template< typename pass_type >
    2217 void PassVisitor< pass_type >::visit( const OffsetPackExpr * node ) {
    2218         VISIT_START( node );
    2219 
    2220         maybeAccept_impl( node->result, *this );
    2221         maybeAccept_impl( node->type  , *this );
    22221612
    22231613        VISIT_END( node );
     
    22521642
    22531643template< typename pass_type >
    2254 void PassVisitor< pass_type >::visit( const AttrExpr * node ) {
    2255         VISIT_START( node );
    2256 
    2257         maybeAccept_impl( node->result, *this );
    2258         if ( node->get_isType() ) {
    2259                 maybeAccept_impl( node->type, *this );
    2260         } else {
    2261                 maybeAccept_impl( node->expr, *this );
    2262         }
    2263 
    2264         VISIT_END( node );
    2265 }
    2266 
    2267 template< typename pass_type >
    22681644Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
    22691645        MUTATE_START( node );
     
    22941670
    22951671template< typename pass_type >
    2296 void PassVisitor< pass_type >::visit( const LogicalExpr * node ) {
    2297         VISIT_START( node );
    2298 
    2299         maybeAccept_impl( node->result, *this );
    2300         maybeAccept_impl( node->arg1  , *this );
    2301         maybeAccept_impl( node->arg2  , *this );
    2302 
    2303         VISIT_END( node );
    2304 }
    2305 
    2306 template< typename pass_type >
    23071672Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
    23081673        MUTATE_START( node );
     
    23311696
    23321697template< typename pass_type >
    2333 void PassVisitor< pass_type >::visit( const ConditionalExpr * node ) {
    2334         VISIT_START( node );
    2335 
    2336         maybeAccept_impl( node->result, *this );
    2337         maybeAccept_impl( node->arg1  , *this );
    2338         maybeAccept_impl( node->arg2  , *this );
    2339         maybeAccept_impl( node->arg3  , *this );
    2340 
    2341         VISIT_END( node );
    2342 }
    2343 
    2344 template< typename pass_type >
    23451698Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
    23461699        MUTATE_START( node );
     
    23691722
    23701723template< typename pass_type >
    2371 void PassVisitor< pass_type >::visit( const CommaExpr * node ) {
    2372         VISIT_START( node );
    2373 
    2374         maybeAccept_impl( node->result, *this );
    2375         maybeAccept_impl( node->arg1  , *this );
    2376         maybeAccept_impl( node->arg2  , *this );
    2377 
    2378         VISIT_END( node );
    2379 }
    2380 
    2381 template< typename pass_type >
    23821724Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
    23831725        MUTATE_START( node );
     
    23991741        indexerScopedAccept( node->result, *this );
    24001742        maybeAccept_impl   ( node->type, *this );
    2401 
    2402         VISIT_END( node );
    2403 }
    2404 
    2405 template< typename pass_type >
    2406 void PassVisitor< pass_type >::visit( const TypeExpr * node ) {
    2407         VISIT_START( node );
    2408 
    2409         maybeAccept_impl( node->result, *this );
    2410         maybeAccept_impl( node->type, *this );
    24111743
    24121744        VISIT_END( node );
     
    24341766        maybeAccept_impl   ( node->constraint, *this );
    24351767        maybeAccept_impl   ( node->operand   , *this );
    2436 
    2437         VISIT_END( node );
    2438 }
    2439 
    2440 template< typename pass_type >
    2441 void PassVisitor< pass_type >::visit( const AsmExpr * node ) {
    2442         VISIT_START( node );
    2443 
    2444         maybeAccept_impl( node->result    , *this );
    2445         maybeAccept_impl( node->inout     , *this );
    2446         maybeAccept_impl( node->constraint, *this );
    2447         maybeAccept_impl( node->operand   , *this );
    24481768
    24491769        VISIT_END( node );
     
    24691789        VISIT_START( node );
    24701790
    2471         indexerScopedAccept( node->result    , *this );
    2472         maybeAccept_impl   ( node->callExpr  , *this );
    2473 
    2474         VISIT_END( node );
    2475 }
    2476 
    2477 template< typename pass_type >
    2478 void PassVisitor< pass_type >::visit( const ImplicitCopyCtorExpr * node ) {
    2479         VISIT_START( node );
    2480 
    2481         maybeAccept_impl( node->result    , *this );
    2482         maybeAccept_impl( node->callExpr  , *this );
     1791        indexerScopedAccept( node->result     , *this );
     1792        maybeAccept_impl   ( node->callExpr   , *this );
     1793        maybeAccept_impl   ( node->tempDecls  , *this );
     1794        maybeAccept_impl   ( node->returnDecls, *this );
     1795        maybeAccept_impl   ( node->dtors      , *this );
    24831796
    24841797        VISIT_END( node );
     
    24891802        MUTATE_START( node );
    24901803
    2491         indexerScopedMutate( node->env       , *this );
    2492         indexerScopedMutate( node->result    , *this );
    2493         maybeMutate_impl   ( node->callExpr  , *this );
     1804        indexerScopedMutate( node->env        , *this );
     1805        indexerScopedMutate( node->result     , *this );
     1806        maybeMutate_impl   ( node->callExpr   , *this );
     1807        maybeMutate_impl   ( node->tempDecls  , *this );
     1808        maybeMutate_impl   ( node->returnDecls, *this );
     1809        maybeMutate_impl   ( node->dtors      , *this );
    24941810
    24951811        MUTATE_END( Expression, node );
     
    25041820        indexerScopedAccept( node->result  , *this );
    25051821        maybeAccept_impl   ( node->callExpr, *this );
    2506 
    2507         VISIT_END( node );
    2508 }
    2509 
    2510 template< typename pass_type >
    2511 void PassVisitor< pass_type >::visit( const ConstructorExpr * node ) {
    2512         VISIT_START( node );
    2513 
    2514         maybeAccept_impl( node->result  , *this );
    2515         maybeAccept_impl( node->callExpr, *this );
    25161822
    25171823        VISIT_END( node );
     
    25421848
    25431849template< typename pass_type >
    2544 void PassVisitor< pass_type >::visit( const CompoundLiteralExpr * node ) {
    2545         VISIT_START( node );
    2546 
    2547         maybeAccept_impl( node->result     , *this );
    2548         maybeAccept_impl( node->initializer, *this );
    2549 
    2550         VISIT_END( node );
    2551 }
    2552 
    2553 template< typename pass_type >
    25541850Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
    25551851        MUTATE_START( node );
     
    25761872
    25771873template< typename pass_type >
    2578 void PassVisitor< pass_type >::visit( const RangeExpr * node ) {
    2579         VISIT_START( node );
    2580 
    2581         maybeAccept_impl( node->result, *this );
    2582         maybeAccept_impl( node->low   , *this );
    2583         maybeAccept_impl( node->high  , *this );
    2584 
    2585         VISIT_END( node );
    2586 }
    2587 
    2588 template< typename pass_type >
    25891874Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
    25901875        MUTATE_START( node );
     
    26111896
    26121897template< typename pass_type >
    2613 void PassVisitor< pass_type >::visit( const UntypedTupleExpr * node ) {
    2614         VISIT_START( node );
    2615 
    2616         maybeAccept_impl( node->result, *this );
    2617         maybeAccept_impl( node->exprs , *this );
    2618 
    2619         VISIT_END( node );
    2620 }
    2621 
    2622 template< typename pass_type >
    26231898Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
    26241899        MUTATE_START( node );
     
    26441919
    26451920template< typename pass_type >
    2646 void PassVisitor< pass_type >::visit( const TupleExpr * node ) {
    2647         VISIT_START( node );
    2648 
    2649         maybeAccept_impl( node->result, *this );
    2650         maybeAccept_impl( node->exprs , *this );
    2651 
    2652         VISIT_END( node );
    2653 }
    2654 
    2655 template< typename pass_type >
    26561921Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
    26571922        MUTATE_START( node );
     
    26771942
    26781943template< typename pass_type >
    2679 void PassVisitor< pass_type >::visit( const TupleIndexExpr * node ) {
    2680         VISIT_START( node );
    2681 
    2682         maybeAccept_impl( node->result, *this );
    2683         maybeAccept_impl( node->tuple , *this );
    2684 
    2685         VISIT_END( node );
    2686 }
    2687 
    2688 template< typename pass_type >
    26891944Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
    26901945        MUTATE_START( node );
     
    27051960        indexerScopedAccept( node->result  , *this );
    27061961        maybeAccept_impl   ( node->stmtExpr, *this );
    2707 
    2708         VISIT_END( node );
    2709 }
    2710 
    2711 template< typename pass_type >
    2712 void PassVisitor< pass_type >::visit( const TupleAssignExpr * node ) {
    2713         VISIT_START( node );
    2714 
    2715         maybeAccept_impl( node->result  , *this );
    2716         maybeAccept_impl( node->stmtExpr, *this );
    27171962
    27181963        VISIT_END( node );
     
    27501995
    27511996template< typename pass_type >
    2752 void PassVisitor< pass_type >::visit( const StmtExpr * node ) {
    2753         VISIT_START( node );
    2754 
    2755         maybeAccept_impl( node->result     , *this );
    2756         maybeAccept_impl( node->statements , *this );
    2757         maybeAccept_impl( node->returnDecls, *this );
    2758         maybeAccept_impl( node->dtors      , *this );
    2759 
    2760         VISIT_END( node );
    2761 }
    2762 
    2763 template< typename pass_type >
    27641997Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
    27651998        MUTATE_START( node );
     
    27912024
    27922025template< typename pass_type >
    2793 void PassVisitor< pass_type >::visit( const UniqueExpr * node ) {
    2794         VISIT_START( node );
    2795 
    2796         maybeAccept_impl( node->result, *this );
    2797         maybeAccept_impl( node->expr  , *this );
    2798 
    2799         VISIT_END( node );
    2800 }
    2801 
    2802 template< typename pass_type >
    28032026Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
    28042027        MUTATE_START( node );
     
    28252048
    28262049template< typename pass_type >
    2827 void PassVisitor< pass_type >::visit( const UntypedInitExpr * node ) {
    2828         VISIT_START( node );
    2829 
    2830         maybeAccept_impl( node->result, *this );
    2831         maybeAccept_impl( node->expr  , *this );
    2832         // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
    2833 
    2834         VISIT_END( node );
    2835 }
    2836 
    2837 template< typename pass_type >
    28382050Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) {
    28392051        MUTATE_START( node );
     
    28612073
    28622074template< typename pass_type >
    2863 void PassVisitor< pass_type >::visit( const InitExpr * node ) {
    2864         VISIT_START( node );
    2865 
    2866         maybeAccept_impl( node->result, *this );
    2867         maybeAccept_impl( node->expr  , *this );
    2868         maybeAccept_impl( node->designation, *this );
    2869 
    2870         VISIT_END( node );
    2871 }
    2872 
    2873 template< typename pass_type >
    28742075Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) {
    28752076        MUTATE_START( node );
     
    28972098
    28982099template< typename pass_type >
    2899 void PassVisitor< pass_type >::visit( const DeletedExpr * node ) {
    2900         VISIT_START( node );
    2901 
    2902         maybeAccept_impl( node->result, *this );
    2903         maybeAccept_impl( node->expr, *this );
    2904         // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
    2905 
    2906         VISIT_END( node );
    2907 }
    2908 
    2909 template< typename pass_type >
    29102100Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) {
    29112101        MUTATE_START( node );
     
    29252115
    29262116        indexerScopedAccept( node->result, *this );
    2927         maybeAccept_impl( node->expr, *this );
    2928 
    2929         VISIT_END( node );
    2930 }
    2931 
    2932 template< typename pass_type >
    2933 void PassVisitor< pass_type >::visit( const DefaultArgExpr * node ) {
    2934         VISIT_START( node );
    2935 
    2936         maybeAccept_impl( node->result, *this );
    29372117        maybeAccept_impl( node->expr, *this );
    29382118
     
    29682148
    29692149template< typename pass_type >
    2970 void PassVisitor< pass_type >::visit( const GenericExpr * node ) {
    2971         VISIT_START( node );
    2972 
    2973         maybeAccept_impl( node->result, *this );
    2974         maybeAccept_impl( node->control, *this );
    2975         for ( const GenericExpr::Association & assoc : node->associations ) {
    2976                 maybeAccept_impl( assoc.type, *this );
    2977                 maybeAccept_impl( assoc.expr, *this );
    2978         }
    2979 
    2980         VISIT_END( node );
    2981 }
    2982 
    2983 template< typename pass_type >
    29842150Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) {
    29852151        MUTATE_START( node );
     
    30082174
    30092175template< typename pass_type >
    3010 void PassVisitor< pass_type >::visit( const VoidType * node ) {
    3011         VISIT_START( node );
    3012 
    3013         maybeAccept_impl( node->forall, *this );
    3014 
    3015         VISIT_END( node );
    3016 }
    3017 
    3018 template< typename pass_type >
    30192176Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
    30202177        MUTATE_START( node );
     
    30292186template< typename pass_type >
    30302187void PassVisitor< pass_type >::visit( BasicType * node ) {
    3031         VISIT_START( node );
    3032 
    3033         maybeAccept_impl( node->forall, *this );
    3034 
    3035         VISIT_END( node );
    3036 }
    3037 
    3038 template< typename pass_type >
    3039 void PassVisitor< pass_type >::visit( const BasicType * node ) {
    30402188        VISIT_START( node );
    30412189
     
    30682216
    30692217template< typename pass_type >
    3070 void PassVisitor< pass_type >::visit( const PointerType * node ) {
    3071         VISIT_START( node );
    3072 
    3073         maybeAccept_impl( node->forall, *this );
    3074         // xxx - should PointerType visit/mutate dimension?
    3075         maybeAccept_impl( node->base, *this );
    3076 
    3077         VISIT_END( node );
    3078 }
    3079 
    3080 template< typename pass_type >
    30812218Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
    30822219        MUTATE_START( node );
     
    31032240
    31042241template< typename pass_type >
    3105 void PassVisitor< pass_type >::visit( const ArrayType * node ) {
    3106         VISIT_START( node );
    3107 
    3108         maybeAccept_impl( node->forall, *this );
    3109         maybeAccept_impl( node->dimension, *this );
    3110         maybeAccept_impl( node->base, *this );
    3111 
    3112         VISIT_END( node );
    3113 }
    3114 
    3115 template< typename pass_type >
    31162242Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
    31172243        MUTATE_START( node );
     
    31372263
    31382264template< typename pass_type >
    3139 void PassVisitor< pass_type >::visit( const ReferenceType * node ) {
    3140         VISIT_START( node );
    3141 
    3142         maybeAccept_impl( node->forall, *this );
    3143         maybeAccept_impl( node->base, *this );
    3144 
    3145         VISIT_END( node );
    3146 }
    3147 
    3148 template< typename pass_type >
    31492265Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
    31502266        MUTATE_START( node );
     
    31702286
    31712287template< typename pass_type >
    3172 void PassVisitor< pass_type >::visit( const QualifiedType * node ) {
    3173         VISIT_START( node );
    3174 
    3175         maybeAccept_impl( node->forall, *this );
    3176         maybeAccept_impl( node->parent, *this );
    3177         maybeAccept_impl( node->child, *this );
    3178 
    3179         VISIT_END( node );
    3180 }
    3181 
    3182 template< typename pass_type >
    31832288Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) {
    31842289        MUTATE_START( node );
     
    31952300template< typename pass_type >
    31962301void PassVisitor< pass_type >::visit( FunctionType * node ) {
    3197         VISIT_START( node );
    3198 
    3199         maybeAccept_impl( node->forall, *this );
    3200         maybeAccept_impl( node->returnVals, *this );
    3201         maybeAccept_impl( node->parameters, *this );
    3202 
    3203         VISIT_END( node );
    3204 }
    3205 
    3206 template< typename pass_type >
    3207 void PassVisitor< pass_type >::visit( const FunctionType * node ) {
    32082302        VISIT_START( node );
    32092303
     
    32442338
    32452339template< typename pass_type >
    3246 void PassVisitor< pass_type >::visit( const StructInstType * node ) {
    3247         VISIT_START( node );
    3248 
    3249         maybeAccept_impl( node->forall    , *this );
    3250         maybeAccept_impl( node->parameters, *this );
    3251 
    3252         VISIT_END( node );
    3253 }
    3254 
    3255 template< typename pass_type >
    32562340Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
    32572341        MUTATE_START( node );
     
    32862370
    32872371template< typename pass_type >
    3288 void PassVisitor< pass_type >::visit( const UnionInstType * node ) {
    3289         VISIT_START( node );
    3290 
    3291         maybeAccept_impl( node->forall    , *this );
    3292         maybeAccept_impl( node->parameters, *this );
    3293 
    3294         VISIT_END( node );
    3295 }
    3296 
    3297 template< typename pass_type >
    32982372Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
    32992373        MUTATE_START( node );
     
    33232397
    33242398template< typename pass_type >
    3325 void PassVisitor< pass_type >::visit( const EnumInstType * node ) {
    3326         VISIT_START( node );
    3327 
    3328         maybeAccept_impl( node->forall, *this );
    3329         maybeAccept_impl( node->parameters, *this );
    3330 
    3331         VISIT_END( node );
    3332 }
    3333 
    3334 template< typename pass_type >
    33352399Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
    33362400        MUTATE_START( node );
     
    33552419
    33562420template< typename pass_type >
    3357 void PassVisitor< pass_type >::visit( const TraitInstType * node ) {
    3358         VISIT_START( node );
    3359 
    3360         maybeAccept_impl( node->forall    , *this );
    3361         maybeAccept_impl( node->parameters, *this );
    3362 
    3363         VISIT_END( node );
    3364 }
    3365 
    3366 template< typename pass_type >
    33672421Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
    33682422        MUTATE_START( node );
     
    33782432template< typename pass_type >
    33792433void PassVisitor< pass_type >::visit( TypeInstType * node ) {
    3380         VISIT_START( node );
    3381 
    3382         maybeAccept_impl( node->forall    , *this );
    3383         maybeAccept_impl( node->parameters, *this );
    3384 
    3385         VISIT_END( node );
    3386 }
    3387 
    3388 template< typename pass_type >
    3389 void PassVisitor< pass_type >::visit( const TypeInstType * node ) {
    33902434        VISIT_START( node );
    33912435
     
    34202464
    34212465template< typename pass_type >
    3422 void PassVisitor< pass_type >::visit( const TupleType * node ) {
    3423         VISIT_START( node );
    3424 
    3425         maybeAccept_impl( node->forall, *this );
    3426         maybeAccept_impl( node->types, *this );
    3427         maybeAccept_impl( node->members, *this );
    3428 
    3429         VISIT_END( node );
    3430 }
    3431 
    3432 template< typename pass_type >
    34332466Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
    34342467        MUTATE_START( node );
     
    34452478template< typename pass_type >
    34462479void PassVisitor< pass_type >::visit( TypeofType * node ) {
    3447         VISIT_START( node );
    3448 
    3449         assert( node->expr );
    3450         maybeAccept_impl( node->expr, *this );
    3451 
    3452         VISIT_END( node );
    3453 }
    3454 
    3455 template< typename pass_type >
    3456 void PassVisitor< pass_type >::visit( const TypeofType * node ) {
    34572480        VISIT_START( node );
    34582481
     
    34912514
    34922515template< typename pass_type >
    3493 void PassVisitor< pass_type >::visit( const AttrType * node ) {
    3494         VISIT_START( node );
    3495 
    3496         if ( node->isType ) {
    3497                 assert( node->type );
    3498                 maybeAccept_impl( node->type, *this );
    3499         } else {
    3500                 assert( node->expr );
    3501                 maybeAccept_impl( node->expr, *this );
    3502         } // if
    3503 
    3504         VISIT_END( node );
    3505 }
    3506 
    3507 template< typename pass_type >
    35082516Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
    35092517        MUTATE_START( node );
     
    35322540
    35332541template< typename pass_type >
    3534 void PassVisitor< pass_type >::visit( const VarArgsType * node ) {
     2542Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
     2543        MUTATE_START( node );
     2544
     2545        maybeMutate_impl( node->forall, *this );
     2546
     2547        MUTATE_END( Type, node );
     2548}
     2549
     2550//--------------------------------------------------------------------------
     2551// ZeroType
     2552template< typename pass_type >
     2553void PassVisitor< pass_type >::visit( ZeroType * node ) {
    35352554        VISIT_START( node );
    35362555
     
    35412560
    35422561template< typename pass_type >
    3543 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
     2562Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
    35442563        MUTATE_START( node );
    35452564
     
    35502569
    35512570//--------------------------------------------------------------------------
    3552 // ZeroType
    3553 template< typename pass_type >
    3554 void PassVisitor< pass_type >::visit( ZeroType * node ) {
     2571// OneType
     2572template< typename pass_type >
     2573void PassVisitor< pass_type >::visit( OneType * node ) {
    35552574        VISIT_START( node );
    35562575
     
    35612580
    35622581template< typename pass_type >
    3563 void PassVisitor< pass_type >::visit( const ZeroType * node ) {
     2582Type * PassVisitor< pass_type >::mutate( OneType * node ) {
     2583        MUTATE_START( node );
     2584
     2585        maybeMutate_impl( node->forall, *this );
     2586
     2587        MUTATE_END( Type, node );
     2588}
     2589
     2590//--------------------------------------------------------------------------
     2591// GlobalScopeType
     2592template< typename pass_type >
     2593void PassVisitor< pass_type >::visit( GlobalScopeType * node ) {
    35642594        VISIT_START( node );
    35652595
     
    35702600
    35712601template< typename pass_type >
    3572 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
     2602Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) {
    35732603        MUTATE_START( node );
    35742604
     
    35792609
    35802610//--------------------------------------------------------------------------
    3581 // OneType
    3582 template< typename pass_type >
    3583 void PassVisitor< pass_type >::visit( OneType * node ) {
    3584         VISIT_START( node );
    3585 
    3586         maybeAccept_impl( node->forall, *this );
    3587 
    3588         VISIT_END( node );
    3589 }
    3590 
    3591 template< typename pass_type >
    3592 void PassVisitor< pass_type >::visit( const OneType * node ) {
    3593         VISIT_START( node );
    3594 
    3595         maybeAccept_impl( node->forall, *this );
    3596 
    3597         VISIT_END( node );
    3598 }
    3599 
    3600 template< typename pass_type >
    3601 Type * PassVisitor< pass_type >::mutate( OneType * node ) {
    3602         MUTATE_START( node );
    3603 
    3604         maybeMutate_impl( node->forall, *this );
    3605 
    3606         MUTATE_END( Type, node );
    3607 }
    3608 
    3609 //--------------------------------------------------------------------------
    3610 // GlobalScopeType
    3611 template< typename pass_type >
    3612 void PassVisitor< pass_type >::visit( GlobalScopeType * node ) {
    3613         VISIT_START( node );
    3614 
    3615         maybeAccept_impl( node->forall, *this );
    3616 
    3617         VISIT_END( node );
    3618 }
    3619 
    3620 template< typename pass_type >
    3621 void PassVisitor< pass_type >::visit( const GlobalScopeType * node ) {
    3622         VISIT_START( node );
    3623 
    3624         maybeAccept_impl( node->forall, *this );
    3625 
    3626         VISIT_END( node );
    3627 }
    3628 
    3629 template< typename pass_type >
    3630 Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) {
    3631         MUTATE_START( node );
    3632 
    3633         maybeMutate_impl( node->forall, *this );
    3634 
    3635         MUTATE_END( Type, node );
    3636 }
    3637 
    3638 //--------------------------------------------------------------------------
    36392611// Designation
    36402612template< typename pass_type >
     
    36482620
    36492621template< typename pass_type >
    3650 void PassVisitor< pass_type >::visit( const Designation * node ) {
    3651         VISIT_START( node );
    3652 
    3653         maybeAccept_impl( node->designators, *this );
    3654 
    3655         VISIT_END( node );
    3656 }
    3657 
    3658 template< typename pass_type >
    36592622Designation * PassVisitor< pass_type >::mutate( Designation * node ) {
    36602623        MUTATE_START( node );
     
    36772640
    36782641template< typename pass_type >
    3679 void PassVisitor< pass_type >::visit( const SingleInit * node ) {
    3680         VISIT_START( node );
    3681 
    3682         visitExpression( node->value );
    3683 
    3684         VISIT_END( node );
    3685 }
    3686 
    3687 template< typename pass_type >
    36882642Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) {
    36892643        MUTATE_START( node );
     
    36982652template< typename pass_type >
    36992653void PassVisitor< pass_type >::visit( ListInit * node ) {
    3700         VISIT_START( node );
    3701 
    3702         maybeAccept_impl( node->designations, *this );
    3703         maybeAccept_impl( node->initializers, *this );
    3704 
    3705         VISIT_END( node );
    3706 }
    3707 
    3708 template< typename pass_type >
    3709 void PassVisitor< pass_type >::visit( const ListInit * node ) {
    37102654        VISIT_START( node );
    37112655
     
    37402684
    37412685template< typename pass_type >
    3742 void PassVisitor< pass_type >::visit( const ConstructorInit * node ) {
    3743         VISIT_START( node );
    3744 
    3745         maybeAccept_impl( node->ctor, *this );
    3746         maybeAccept_impl( node->dtor, *this );
    3747         maybeAccept_impl( node->init, *this );
    3748 
    3749         VISIT_END( node );
    3750 }
    3751 
    3752 template< typename pass_type >
    37532686Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
    37542687        MUTATE_START( node );
     
    37712704
    37722705template< typename pass_type >
    3773 void PassVisitor< pass_type >::visit( const Constant * node ) {
    3774         VISIT_START( node );
    3775 
    3776         VISIT_END( node );
    3777 }
    3778 
    3779 template< typename pass_type >
    37802706Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
    37812707        MUTATE_START( node );
     
    37882714template< typename pass_type >
    37892715void PassVisitor< pass_type >::visit( Attribute * node ) {
    3790         VISIT_START( node );
    3791 
    3792         maybeAccept_impl( node->parameters, *this );
    3793 
    3794         VISIT_END( node );
    3795 }
    3796 
    3797 template< typename pass_type >
    3798 void PassVisitor< pass_type >::visit( const Attribute * node ) {
    37992716        VISIT_START( node );
    38002717
Note: See TracChangeset for help on using the changeset viewer.