Ignore:
File:
1 edited

Legend:

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

    ree3c93d r033ff37  
    2020
    2121#define MUTATE_END( type, node )                \
    22         return call_postmutate< type * >( node ); \
    23 
    24 
    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 );      \
    39 
     22        auto __return = call_postmutate< type * >( node ); \
     23        assert( __return ); \
     24        return __return;
    4025
    4126
     
    6752        SemanticErrorException errors;
    6853
     54        pass_visitor_stats.depth++;
     55        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     56        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    6957        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     58
     59
    7060                // splice in new declarations after previous decl
    7161                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     
    8373                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    8474        }
     75        pass_visitor_stats.depth--;
     76        if ( ! errors.isEmpty() ) {
     77                throw errors;
     78        }
     79}
     80
     81template< typename pass_type >
     82inline 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--;
    8598        if ( ! errors.isEmpty() ) {
    8699                throw errors;
     
    94107        SemanticErrorException errors;
    95108
     109        pass_visitor_stats.depth++;
     110        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     111        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    96112        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    97113                // splice in new declarations after previous decl
     
    109125                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    110126        }
     127        pass_visitor_stats.depth--;
    111128        if ( ! errors.isEmpty() ) {
    112129                throw errors;
     
    122139}
    123140
     141template< typename TreeType, typename pass_type >
     142inline 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
    124149template< typename Container, typename pass_type >
    125150inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) {
    126151        if ( ! visitor.get_visit_children() ) return;
    127152        SemanticErrorException errors;
     153
     154        pass_visitor_stats.depth++;
     155        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     156        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    128157        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    129158                try {
     
    135164                }
    136165        }
     166        pass_visitor_stats.depth--;
     167        if ( ! errors.isEmpty() ) {
     168                throw errors;
     169        }
     170}
     171
     172template< typename Container, typename pass_type >
     173inline 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 );
     184                        }
     185                } catch( SemanticErrorException &e ) {
     186                        errors.append( e );
     187                }
     188        }
     189        pass_visitor_stats.depth--;
    137190        if ( ! errors.isEmpty() ) {
    138191                throw errors;
     
    151204template< typename Container, typename pass_type >
    152205inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) {
     206
    153207        if ( ! mutator.get_visit_children() ) return;
    154208        SemanticErrorException errors;
     209
     210        pass_visitor_stats.depth++;
     211        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     212        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    155213        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    156214                try {
     
    163221                } // try
    164222        } // for
     223        pass_visitor_stats.depth--;
    165224        if ( ! errors.isEmpty() ) {
    166225                throw errors;
     
    185244        DeclList_t* afterDecls  = get_afterDecls();
    186245
     246        pass_visitor_stats.depth++;
     247        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     248        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    187249        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    188250
     
    192254                try {
    193255                        func( *i );
     256                        assert( *i );
    194257                        assert(( empty( beforeStmts ) && empty( afterStmts ))
    195258                            || ( empty( beforeDecls ) && empty( afterDecls )) );
     
    202265                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    203266        }
     267        pass_visitor_stats.depth--;
    204268
    205269        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
     
    216280
    217281template< typename pass_type >
     282void 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
     300template< typename pass_type >
    218301void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
    219302        handleStatementList( statements, [this]( Statement *& stmt) {
     
    229312
    230313        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    231         ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
     314        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    232315        ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
    233316        ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
     
    264347
    265348template< typename pass_type >
     349void 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
     358template< typename pass_type >
    266359Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
    267360        return handleStatement( stmt, [this]( Statement * stmt ) {
     
    295388
    296389template< typename pass_type >
     390void 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
     402template< typename pass_type >
    297403Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
    298404        return handleExpression(expr, [this]( Expression * expr ) {
     
    304410template< typename TreeType, typename VisitorType >
    305411inline 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
     420template< typename TreeType, typename VisitorType >
     421inline void indexerScopedAccept( const TreeType * tree, VisitorType & visitor ) {
    306422        if ( ! visitor.get_visit_children() ) return;
    307423        auto guard = makeFuncGuard(
     
    366482
    367483template< typename pass_type >
     484void 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 );
     491
     492        VISIT_END( node );
     493}
     494
     495template< typename pass_type >
    368496DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
    369497        MUTATE_START( node );
     
    404532                        indexerAddId( &func );
    405533                        maybeAccept_impl( node->type, *this );
     534                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     535                        // a new scope if inFunction is true
     536                        ValueGuard< bool > oldInFunction( inFunction );
     537                        inFunction = true;
     538                        maybeAccept_impl( node->statements, *this );
     539                        maybeAccept_impl( node->attributes, *this );
     540                }
     541        }
     542
     543        VISIT_END( node );
     544}
     545
     546template< typename pass_type >
     547void PassVisitor< pass_type >::visit( const FunctionDecl * node ) {
     548        VISIT_START( node );
     549
     550        indexerAddId( node );
     551
     552        maybeAccept_impl( node->withExprs, *this );
     553        {
     554                // with clause introduces a level of scope (for the with expression members).
     555                // with clause exprs are added to the indexer before parameters so that parameters
     556                // shadow with exprs and not the other way around.
     557                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     558                indexerAddWith( node->withExprs, node );
     559                {
     560                        auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     561                        // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     562                        static ObjectDecl func(
     563                                "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     564                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     565                                nullptr
     566                        );
     567                        indexerAddId( &func );
     568                        maybeAccept_impl( node->type, *this );
     569                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     570                        // a new scope if inFunction is true
     571                        ValueGuard< bool > oldInFunction( inFunction );
     572                        inFunction = true;
    406573                        maybeAccept_impl( node->statements, *this );
    407574                        maybeAccept_impl( node->attributes, *this );
     
    434601                        indexerAddId( &func );
    435602                        maybeMutate_impl( node->type, *this );
     603                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     604                        // a new scope if inFunction is true
     605                        ValueGuard< bool > oldInFunction( inFunction );
     606                        inFunction = true;
    436607                        maybeMutate_impl( node->statements, *this );
    437608                        maybeMutate_impl( node->attributes, *this );
     
    465636
    466637template< typename pass_type >
    467 Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
    468         MUTATE_START( node );
     638void PassVisitor< pass_type >::visit( const StructDecl * node ) {
     639        VISIT_START( node );
    469640
    470641        // make up a forward declaration and add it before processing the members
     
    474645        {
    475646                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     647                maybeAccept_impl( node->parameters, *this );
     648                maybeAccept_impl( node->members   , *this );
     649        }
     650
     651        // this addition replaces the forward declaration
     652        indexerAddStruct( node );
     653
     654        VISIT_END( node );
     655}
     656
     657template< typename pass_type >
     658Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
     659        MUTATE_START( node );
     660
     661        // make up a forward declaration and add it before processing the members
     662        // needs to be on the heap because addStruct saves the pointer
     663        indexerAddStructFwd( node );
     664
     665        {
     666                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    476667                maybeMutate_impl( node->parameters, *this );
    477668                maybeMutate_impl( node->members   , *this );
     
    503694        VISIT_END( node );
    504695}
     696template< typename pass_type >
     697void PassVisitor< pass_type >::visit( const UnionDecl * node ) {
     698        VISIT_START( node );
     699
     700        // make up a forward declaration and add it before processing the members
     701        indexerAddUnionFwd( node );
     702
     703        {
     704                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     705                maybeAccept_impl( node->parameters, *this );
     706                maybeAccept_impl( node->members   , *this );
     707        }
     708
     709        indexerAddUnion( node );
     710
     711        VISIT_END( node );
     712}
    505713
    506714template< typename pass_type >
     
    538746
    539747template< typename pass_type >
     748void PassVisitor< pass_type >::visit( const EnumDecl * node ) {
     749        VISIT_START( node );
     750
     751        indexerAddEnum( node );
     752
     753        // unlike structs, traits, and unions, enums inject their members into the global scope
     754        maybeAccept_impl( node->parameters, *this );
     755        maybeAccept_impl( node->members   , *this );
     756
     757        VISIT_END( node );
     758}
     759
     760template< typename pass_type >
    540761Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
    541762        MUTATE_START( node );
     
    554775template< typename pass_type >
    555776void PassVisitor< pass_type >::visit( TraitDecl * node ) {
     777        VISIT_START( node );
     778
     779        {
     780                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     781                maybeAccept_impl( node->parameters, *this );
     782                maybeAccept_impl( node->members   , *this );
     783        }
     784
     785        indexerAddTrait( node );
     786
     787        VISIT_END( node );
     788}
     789
     790template< typename pass_type >
     791void PassVisitor< pass_type >::visit( const TraitDecl * node ) {
    556792        VISIT_START( node );
    557793
     
    606842}
    607843
    608 template< typename pass_type >
    609 Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
    610         MUTATE_START( node );
     844
     845template< typename pass_type >
     846void PassVisitor< pass_type >::visit( const TypeDecl * node ) {
     847        VISIT_START( node );
    611848
    612849        {
    613850                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    614                 maybeMutate_impl( node->parameters, *this );
    615                 maybeMutate_impl( node->base      , *this );
     851                maybeAccept_impl( node->parameters, *this );
     852                maybeAccept_impl( node->base      , *this );
    616853        }
    617854
     
    621858        indexerAddType( node );
    622859
     860        maybeAccept_impl( node->assertions, *this );
     861
     862        indexerScopedAccept( node->init, *this );
     863
     864        VISIT_END( node );
     865}
     866
     867template< typename pass_type >
     868Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
     869        MUTATE_START( node );
     870
     871        {
     872                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     873                maybeMutate_impl( node->parameters, *this );
     874                maybeMutate_impl( node->base      , *this );
     875        }
     876
     877        // see A NOTE ON THE ORDER OF TRAVERSAL, above
     878        // note that assertions come after the type is added to the symtab, since they are not part of the type proper
     879        // and may depend on the type itself
     880        indexerAddType( node );
     881
    623882        maybeMutate_impl( node->assertions, *this );
    624883
     
    648907
    649908template< typename pass_type >
     909void PassVisitor< pass_type >::visit( const TypedefDecl * node ) {
     910        VISIT_START( node );
     911
     912        {
     913                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     914                maybeAccept_impl( node->parameters, *this );
     915                maybeAccept_impl( node->base      , *this );
     916        }
     917
     918        indexerAddType( node );
     919
     920        maybeAccept_impl( node->assertions, *this );
     921
     922        VISIT_END( node );
     923}
     924
     925template< typename pass_type >
    650926Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
    651927        MUTATE_START( node );
     
    676952
    677953template< typename pass_type >
     954void PassVisitor< pass_type >::visit( const AsmDecl * node ) {
     955        VISIT_START( node );
     956
     957        maybeAccept_impl( node->stmt, *this );
     958
     959        VISIT_END( node );
     960}
     961
     962template< typename pass_type >
    678963AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
    679964        MUTATE_START( node );
     
    697982
    698983template< typename pass_type >
     984void PassVisitor< pass_type >::visit( const StaticAssertDecl * node ) {
     985        VISIT_START( node );
     986
     987        visitExpression( node->condition );
     988        maybeAccept_impl( node->message, *this );
     989
     990        VISIT_END( node );
     991}
     992
     993template< typename pass_type >
    699994StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) {
    700995        MUTATE_START( node );
     
    7121007        VISIT_START( node );
    7131008        {
    714                 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1009                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     1010                ValueGuard< bool > oldInFunction( inFunction );
     1011                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    7151012                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     1013                inFunction = false;
    7161014                visitStatementList( node->kids );
    7171015        }
     
    7201018
    7211019template< typename pass_type >
     1020void PassVisitor< pass_type >::visit( const CompoundStmt * node ) {
     1021        VISIT_START( node );
     1022        {
     1023                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     1024                ValueGuard< bool > oldInFunction( inFunction );
     1025                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
     1026                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     1027                inFunction = false;
     1028                visitStatementList( node->kids );
     1029        }
     1030        VISIT_END( node );
     1031}
     1032
     1033template< typename pass_type >
    7221034CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
    7231035        MUTATE_START( node );
    7241036        {
    725                 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1037                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     1038                ValueGuard< bool > oldInFunction( inFunction );
     1039                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    7261040                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     1041                inFunction = false;
    7271042                mutateStatementList( node->kids );
    7281043        }
     
    7341049template< typename pass_type >
    7351050void PassVisitor< pass_type >::visit( ExprStmt * node ) {
     1051        VISIT_START( node );
     1052
     1053        visitExpression( node->expr );
     1054
     1055        VISIT_END( node );
     1056}
     1057
     1058template< typename pass_type >
     1059void PassVisitor< pass_type >::visit( const ExprStmt * node ) {
    7361060        VISIT_START( node );
    7371061
     
    7651089
    7661090template< typename pass_type >
     1091void PassVisitor< pass_type >::visit( const AsmStmt * node ) {
     1092        VISIT_START( node )
     1093
     1094        maybeAccept_impl( node->instruction, *this );
     1095        maybeAccept_impl( node->output, *this );
     1096        maybeAccept_impl( node->input, *this );
     1097        maybeAccept_impl( node->clobber, *this );
     1098
     1099        VISIT_END( node );
     1100}
     1101
     1102template< typename pass_type >
    7671103Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    7681104        MUTATE_START( node );
     
    7861122
    7871123template< typename pass_type >
     1124void PassVisitor< pass_type >::visit( const DirectiveStmt * node ) {
     1125        VISIT_START( node )
     1126
     1127        VISIT_END( node );
     1128}
     1129
     1130template< typename pass_type >
    7881131Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
    7891132        MUTATE_START( node );
     
    8001143                // if statements introduce a level of scope (for the initialization)
    8011144                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    802                 maybeAccept_impl( node->get_initialization(), *this );
     1145                maybeAccept_impl( node->initialization, *this );
    8031146                visitExpression ( node->condition );
    8041147                node->thenPart = visitStatement( node->thenPart );
     
    8091152
    8101153template< typename pass_type >
    811 Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    812         MUTATE_START( node );
     1154void PassVisitor< pass_type >::visit( const IfStmt * node ) {
     1155        VISIT_START( node );
    8131156        {
    8141157                // if statements introduce a level of scope (for the initialization)
    8151158                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    816                 maybeMutate_impl( node->get_initialization(), *this );
     1159                maybeAccept_impl( node->initialization, *this );
     1160                visitExpression ( node->condition );
     1161                visitStatement  ( node->thenPart );
     1162                visitStatement  ( node->elsePart );
     1163        }
     1164        VISIT_END( node );
     1165}
     1166
     1167template< typename pass_type >
     1168Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
     1169        MUTATE_START( node );
     1170        {
     1171                // if statements introduce a level of scope (for the initialization)
     1172                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1173                maybeMutate_impl( node->initialization, *this );
    8171174                node->condition = mutateExpression( node->condition );
    8181175                node->thenPart  = mutateStatement ( node->thenPart  );
     
    8341191                visitExpression ( node->condition );
    8351192                node->body = visitStatement( node->body );
     1193        }
     1194
     1195        VISIT_END( node );
     1196}
     1197
     1198template< typename pass_type >
     1199void PassVisitor< pass_type >::visit( const WhileStmt * node ) {
     1200        VISIT_START( node );
     1201
     1202        {
     1203                // while statements introduce a level of scope (for the initialization)
     1204                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1205                maybeAccept_impl( node->initialization, *this );
     1206                visitExpression ( node->condition );
     1207                visitStatement  ( node->body );
    8361208        }
    8371209
     
    8721244
    8731245template< typename pass_type >
     1246void PassVisitor< pass_type >::visit( const ForStmt * node ) {
     1247        VISIT_START( node );
     1248        {
     1249                // for statements introduce a level of scope (for the initialization)
     1250                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1251                maybeAccept_impl( node->initialization, *this );
     1252                visitExpression( node->condition );
     1253                visitExpression( node->increment );
     1254                visitStatement ( node->body );
     1255        }
     1256        VISIT_END( node );
     1257}
     1258
     1259template< typename pass_type >
    8741260Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    8751261        MUTATE_START( node );
     
    8981284
    8991285template< typename pass_type >
     1286void PassVisitor< pass_type >::visit( const SwitchStmt * node ) {
     1287        VISIT_START( node );
     1288
     1289        visitExpression   ( node->condition  );
     1290        visitStatementList( node->statements );
     1291
     1292        VISIT_END( node );
     1293}
     1294
     1295template< typename pass_type >
    9001296Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
    9011297        MUTATE_START( node );
     
    9201316
    9211317template< typename pass_type >
     1318void PassVisitor< pass_type >::visit( const CaseStmt * node ) {
     1319        VISIT_START( node );
     1320
     1321        visitExpression   ( node->condition );
     1322        visitStatementList( node->stmts     );
     1323
     1324        VISIT_END( node );
     1325}
     1326
     1327template< typename pass_type >
    9221328Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
    9231329        MUTATE_START( node );
     
    9381344
    9391345template< typename pass_type >
     1346void PassVisitor< pass_type >::visit( const BranchStmt * node ) {
     1347        VISIT_START( node );
     1348        VISIT_END( node );
     1349}
     1350
     1351template< typename pass_type >
    9401352Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    9411353        MUTATE_START( node );
     
    9551367
    9561368template< typename pass_type >
     1369void PassVisitor< pass_type >::visit( const ReturnStmt * node ) {
     1370        VISIT_START( node );
     1371
     1372        visitExpression( node->expr );
     1373
     1374        VISIT_END( node );
     1375}
     1376
     1377template< typename pass_type >
    9571378Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
    9581379        MUTATE_START( node );
     
    9651386//--------------------------------------------------------------------------
    9661387// ThrowStmt
    967 
    9681388template< typename pass_type >
    9691389void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
     
    9771397
    9781398template< typename pass_type >
     1399void PassVisitor< pass_type >::visit( const ThrowStmt * node ) {
     1400        VISIT_START( node );
     1401
     1402        maybeAccept_impl( node->expr, *this );
     1403        maybeAccept_impl( node->target, *this );
     1404
     1405        VISIT_END( node );
     1406}
     1407
     1408template< typename pass_type >
    9791409Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    9801410        MUTATE_START( node );
     
    9901420template< typename pass_type >
    9911421void PassVisitor< pass_type >::visit( TryStmt * node ) {
     1422        VISIT_START( node );
     1423
     1424        maybeAccept_impl( node->block       , *this );
     1425        maybeAccept_impl( node->handlers    , *this );
     1426        maybeAccept_impl( node->finallyBlock, *this );
     1427
     1428        VISIT_END( node );
     1429}
     1430
     1431template< typename pass_type >
     1432void PassVisitor< pass_type >::visit( const TryStmt * node ) {
    9921433        VISIT_START( node );
    9931434
     
    10261467
    10271468template< typename pass_type >
     1469void PassVisitor< pass_type >::visit( const CatchStmt * node ) {
     1470        VISIT_START( node );
     1471        {
     1472                // catch statements introduce a level of scope (for the caught exception)
     1473                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1474                maybeAccept_impl( node->decl, *this );
     1475                visitExpression ( node->cond );
     1476                visitStatement  ( node->body );
     1477        }
     1478        VISIT_END( node );
     1479}
     1480
     1481template< typename pass_type >
    10281482Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    10291483        MUTATE_START( node );
     
    10501504
    10511505template< typename pass_type >
     1506void PassVisitor< pass_type >::visit( const FinallyStmt * node ) {
     1507        VISIT_START( node );
     1508
     1509        maybeAccept_impl( node->block, *this );
     1510
     1511        VISIT_END( node );
     1512}
     1513
     1514template< typename pass_type >
    10521515Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    10531516        MUTATE_START( node );
     
    10821545
    10831546template< typename pass_type >
     1547void PassVisitor< pass_type >::visit( const WaitForStmt * node ) {
     1548        VISIT_START( node );
     1549
     1550        for( auto & clause : node->clauses ) {
     1551                maybeAccept_impl( clause.target.function, *this );
     1552                maybeAccept_impl( clause.target.arguments, *this );
     1553
     1554                maybeAccept_impl( clause.statement, *this );
     1555                maybeAccept_impl( clause.condition, *this );
     1556        }
     1557
     1558        maybeAccept_impl( node->timeout.time, *this );
     1559        maybeAccept_impl( node->timeout.statement, *this );
     1560        maybeAccept_impl( node->timeout.condition, *this );
     1561        maybeAccept_impl( node->orelse.statement, *this );
     1562        maybeAccept_impl( node->orelse.condition, *this );
     1563
     1564        VISIT_END( node );
     1565}
     1566
     1567template< typename pass_type >
    10841568Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
    10851569        MUTATE_START( node );
     
    11051589
    11061590//--------------------------------------------------------------------------
    1107 // NullStmt
     1591// WithStmt
    11081592template< typename pass_type >
    11091593void PassVisitor< pass_type >::visit( WithStmt * node ) {
     
    11201604
    11211605template< typename pass_type >
    1122 Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) {
     1606void PassVisitor< pass_type >::visit( const WithStmt * node ) {
     1607        VISIT_START( node );
     1608        maybeAccept_impl( node->exprs, *this );
     1609        {
     1610                // catch statements introduce a level of scope (for the caught exception)
     1611                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1612                indexerAddWith( node->exprs, node );
     1613                maybeAccept_impl( node->stmt, *this );
     1614        }
     1615        VISIT_END( node );
     1616}
     1617
     1618template< typename pass_type >
     1619Declaration * PassVisitor< pass_type >::mutate( WithStmt * node ) {
    11231620        MUTATE_START( node );
    11241621        maybeMutate_impl( node->exprs, *this );
     
    11291626                maybeMutate_impl( node->stmt, *this );
    11301627        }
     1628        MUTATE_END( Declaration, node );
     1629}
     1630
     1631//--------------------------------------------------------------------------
     1632// NullStmt
     1633template< typename pass_type >
     1634void PassVisitor< pass_type >::visit( NullStmt * node ) {
     1635        VISIT_START( node );
     1636        VISIT_END( node );
     1637}
     1638
     1639template< typename pass_type >
     1640void PassVisitor< pass_type >::visit( const NullStmt * node ) {
     1641        VISIT_START( node );
     1642        VISIT_END( node );
     1643}
     1644
     1645template< typename pass_type >
     1646NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
     1647        MUTATE_START( node );
     1648        MUTATE_END( NullStmt, node );
     1649}
     1650
     1651//--------------------------------------------------------------------------
     1652// DeclStmt
     1653template< typename pass_type >
     1654void PassVisitor< pass_type >::visit( DeclStmt * node ) {
     1655        VISIT_START( node );
     1656
     1657        maybeAccept_impl( node->decl, *this );
     1658
     1659        VISIT_END( node );
     1660}
     1661
     1662template< typename pass_type >
     1663void PassVisitor< pass_type >::visit( const DeclStmt * node ) {
     1664        VISIT_START( node );
     1665
     1666        maybeAccept_impl( node->decl, *this );
     1667
     1668        VISIT_END( node );
     1669}
     1670
     1671template< typename pass_type >
     1672Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
     1673        MUTATE_START( node );
     1674
     1675        maybeMutate_impl( node->decl, *this );
     1676
    11311677        MUTATE_END( Statement, node );
    11321678}
    11331679
    11341680//--------------------------------------------------------------------------
    1135 // NullStmt
    1136 template< typename pass_type >
    1137 void PassVisitor< pass_type >::visit( NullStmt * node ) {
    1138         VISIT_START( node );
    1139         VISIT_END( node );
    1140 }
    1141 
    1142 template< typename pass_type >
    1143 NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
    1144         MUTATE_START( node );
    1145         MUTATE_END( NullStmt, node );
    1146 }
    1147 
    1148 //--------------------------------------------------------------------------
    1149 // DeclStmt
    1150 template< typename pass_type >
    1151 void PassVisitor< pass_type >::visit( DeclStmt * node ) {
    1152         VISIT_START( node );
    1153 
    1154         maybeAccept_impl( node->decl, *this );
    1155 
    1156         VISIT_END( node );
    1157 }
    1158 
    1159 template< typename pass_type >
    1160 Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
    1161         MUTATE_START( node );
    1162 
    1163         maybeMutate_impl( node->decl, *this );
     1681// ImplicitCtorDtorStmt
     1682template< typename pass_type >
     1683void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
     1684        VISIT_START( node );
     1685
     1686        maybeAccept_impl( node->callStmt, *this );
     1687
     1688        VISIT_END( node );
     1689}
     1690
     1691template< typename pass_type >
     1692void PassVisitor< pass_type >::visit( const ImplicitCtorDtorStmt * node ) {
     1693        VISIT_START( node );
     1694
     1695        maybeAccept_impl( node->callStmt, *this );
     1696
     1697        VISIT_END( node );
     1698}
     1699
     1700template< typename pass_type >
     1701Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
     1702        MUTATE_START( node );
     1703
     1704        maybeMutate_impl( node->callStmt, *this );
    11641705
    11651706        MUTATE_END( Statement, node );
     
    11671708
    11681709//--------------------------------------------------------------------------
    1169 // ImplicitCtorDtorStmt
    1170 template< typename pass_type >
    1171 void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
    1172         VISIT_START( node );
    1173 
    1174         maybeAccept_impl( node->callStmt, *this );
    1175 
    1176         VISIT_END( node );
    1177 }
    1178 
    1179 template< typename pass_type >
    1180 Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
    1181         MUTATE_START( node );
    1182 
    1183         maybeMutate_impl( node->callStmt, *this );
    1184 
    1185         MUTATE_END( Statement, node );
    1186 }
    1187 
    1188 //--------------------------------------------------------------------------
    11891710// ApplicationExpr
    11901711template< typename pass_type >
     
    11931714
    11941715        indexerScopedAccept( node->result  , *this );
    1195         maybeAccept_impl        ( node->function, *this );
    1196         maybeAccept_impl        ( node->args    , *this );
     1716        maybeAccept_impl   ( node->function, *this );
     1717        maybeAccept_impl   ( node->args    , *this );
     1718
     1719        VISIT_END( node );
     1720}
     1721
     1722template< typename pass_type >
     1723void PassVisitor< pass_type >::visit( const ApplicationExpr * node ) {
     1724        VISIT_START( node );
     1725
     1726        indexerScopedAccept( node->result  , *this );
     1727        maybeAccept_impl   ( node->function, *this );
     1728        maybeAccept_impl   ( node->args    , *this );
    11971729
    11981730        VISIT_END( node );
     
    12281760
    12291761template< typename pass_type >
     1762void PassVisitor< pass_type >::visit( const UntypedExpr * node ) {
     1763        VISIT_START( node );
     1764
     1765        indexerScopedAccept( node->result, *this );
     1766
     1767        for ( auto expr : node->args ) {
     1768                visitExpression( expr );
     1769        }
     1770
     1771        VISIT_END( node );
     1772}
     1773
     1774template< typename pass_type >
    12301775Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
    12311776        MUTATE_START( node );
     
    12531798
    12541799template< typename pass_type >
     1800void PassVisitor< pass_type >::visit( const NameExpr * node ) {
     1801        VISIT_START( node );
     1802
     1803        indexerScopedAccept( node->result, *this );
     1804
     1805        VISIT_END( node );
     1806}
     1807
     1808template< typename pass_type >
    12551809Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
    12561810        MUTATE_START( node );
     
    12691823
    12701824        indexerScopedAccept( node->result, *this );
    1271         maybeAccept_impl        ( node->arg   , *this );
     1825        maybeAccept_impl   ( node->arg   , *this );
     1826
     1827        VISIT_END( node );
     1828}
     1829
     1830template< typename pass_type >
     1831void PassVisitor< pass_type >::visit( const CastExpr * node ) {
     1832        VISIT_START( node );
     1833
     1834        indexerScopedAccept( node->result, *this );
     1835        maybeAccept_impl   ( node->arg   , *this );
    12721836
    12731837        VISIT_END( node );
     
    12981862
    12991863template< typename pass_type >
     1864void PassVisitor< pass_type >::visit( const KeywordCastExpr * node ) {
     1865        VISIT_START( node );
     1866
     1867        indexerScopedAccept( node->result, *this );
     1868        maybeAccept_impl   ( node->arg   , *this );
     1869
     1870        VISIT_END( node );
     1871}
     1872
     1873template< typename pass_type >
    13001874Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) {
    13011875        MUTATE_START( node );
     
    13151889
    13161890        indexerScopedAccept( node->result, *this );
    1317         maybeAccept_impl( node->arg, *this );
     1891        maybeAccept_impl   ( node->arg, *this );
     1892
     1893        VISIT_END( node );
     1894}
     1895
     1896template< typename pass_type >
     1897void PassVisitor< pass_type >::visit( const VirtualCastExpr * node ) {
     1898        VISIT_START( node );
     1899
     1900        indexerScopedAccept( node->result, *this );
     1901        maybeAccept_impl   ( node->arg, *this );
    13181902
    13191903        VISIT_END( node );
     
    13441928
    13451929template< typename pass_type >
     1930void PassVisitor< pass_type >::visit( const AddressExpr * node ) {
     1931        VISIT_START( node );
     1932
     1933        indexerScopedAccept( node->result, *this );
     1934        maybeAccept_impl   ( node->arg   , *this );
     1935
     1936        VISIT_END( node );
     1937}
     1938
     1939template< typename pass_type >
    13461940Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
    13471941        MUTATE_START( node );
     
    13661960
    13671961template< typename pass_type >
     1962void PassVisitor< pass_type >::visit( const LabelAddressExpr * node ) {
     1963        VISIT_START( node );
     1964
     1965        indexerScopedAccept( node->result, *this );
     1966
     1967        VISIT_END( node );
     1968}
     1969
     1970template< typename pass_type >
    13681971Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
    13691972        MUTATE_START( node );
     
    13791982template< typename pass_type >
    13801983void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
     1984        VISIT_START( node );
     1985
     1986        indexerScopedAccept( node->result   , *this );
     1987        maybeAccept_impl   ( node->aggregate, *this );
     1988        maybeAccept_impl   ( node->member   , *this );
     1989
     1990        VISIT_END( node );
     1991}
     1992
     1993template< typename pass_type >
     1994void PassVisitor< pass_type >::visit( const UntypedMemberExpr * node ) {
    13811995        VISIT_START( node );
    13821996
     
    14132027
    14142028template< typename pass_type >
     2029void PassVisitor< pass_type >::visit( const MemberExpr * node ) {
     2030        VISIT_START( node );
     2031
     2032        indexerScopedAccept( node->result   , *this );
     2033        maybeAccept_impl   ( node->aggregate, *this );
     2034
     2035        VISIT_END( node );
     2036}
     2037
     2038template< typename pass_type >
    14152039Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
    14162040        MUTATE_START( node );
     
    14352059
    14362060template< typename pass_type >
     2061void PassVisitor< pass_type >::visit( const VariableExpr * node ) {
     2062        VISIT_START( node );
     2063
     2064        indexerScopedAccept( node->result, *this );
     2065
     2066        VISIT_END( node );
     2067}
     2068
     2069template< typename pass_type >
    14372070Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
    14382071        MUTATE_START( node );
     
    14482081template< typename pass_type >
    14492082void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
     2083        VISIT_START( node );
     2084
     2085        indexerScopedAccept( node->result   , *this );
     2086        maybeAccept_impl   ( &node->constant, *this );
     2087
     2088        VISIT_END( node );
     2089}
     2090
     2091template< typename pass_type >
     2092void PassVisitor< pass_type >::visit( const ConstantExpr * node ) {
    14502093        VISIT_START( node );
    14512094
     
    14732116template< typename pass_type >
    14742117void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
     2118        VISIT_START( node );
     2119
     2120        indexerScopedAccept( node->result, *this );
     2121        if ( node->get_isType() ) {
     2122                maybeAccept_impl( node->type, *this );
     2123        } else {
     2124                maybeAccept_impl( node->expr, *this );
     2125        }
     2126
     2127        VISIT_END( node );
     2128}
     2129
     2130template< typename pass_type >
     2131void PassVisitor< pass_type >::visit( const SizeofExpr * node ) {
    14752132        VISIT_START( node );
    14762133
     
    15172174
    15182175template< typename pass_type >
     2176void PassVisitor< pass_type >::visit( const AlignofExpr * node ) {
     2177        VISIT_START( node );
     2178
     2179        indexerScopedAccept( node->result, *this );
     2180        if ( node->get_isType() ) {
     2181                maybeAccept_impl( node->type, *this );
     2182        } else {
     2183                maybeAccept_impl( node->expr, *this );
     2184        }
     2185
     2186        VISIT_END( node );
     2187}
     2188
     2189template< typename pass_type >
    15192190Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
    15202191        MUTATE_START( node );
     
    15442215
    15452216template< typename pass_type >
     2217void PassVisitor< pass_type >::visit( const UntypedOffsetofExpr * node ) {
     2218        VISIT_START( node );
     2219
     2220        indexerScopedAccept( node->result, *this );
     2221        maybeAccept_impl   ( node->type  , *this );
     2222
     2223        VISIT_END( node );
     2224}
     2225
     2226template< typename pass_type >
    15462227Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
    15472228        MUTATE_START( node );
     
    15672248
    15682249template< typename pass_type >
     2250void PassVisitor< pass_type >::visit( const OffsetofExpr * node ) {
     2251        VISIT_START( node );
     2252
     2253        indexerScopedAccept( node->result, *this );
     2254        maybeAccept_impl   ( node->type  , *this );
     2255
     2256        VISIT_END( node );
     2257}
     2258
     2259template< typename pass_type >
    15692260Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
    15702261        MUTATE_START( node );
     
    15902281
    15912282template< typename pass_type >
     2283void PassVisitor< pass_type >::visit( const OffsetPackExpr * node ) {
     2284        VISIT_START( node );
     2285
     2286        indexerScopedAccept( node->result, *this );
     2287        maybeAccept_impl   ( node->type  , *this );
     2288
     2289        VISIT_END( node );
     2290}
     2291
     2292template< typename pass_type >
    15922293Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
    15932294        MUTATE_START( node );
     
    16012302
    16022303//--------------------------------------------------------------------------
    1603 // AttrExpr
    1604 template< typename pass_type >
    1605 void PassVisitor< pass_type >::visit( AttrExpr * node ) {
    1606         VISIT_START( node );
    1607 
    1608         indexerScopedAccept( node->result, *this );
    1609         if ( node->get_isType() ) {
    1610                 maybeAccept_impl( node->type, *this );
    1611         } else {
    1612                 maybeAccept_impl( node->expr, *this );
    1613         }
    1614 
    1615         VISIT_END( node );
    1616 }
    1617 
    1618 template< typename pass_type >
    1619 Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
    1620         MUTATE_START( node );
    1621 
    1622         indexerScopedMutate( node->env   , *this );
    1623         indexerScopedMutate( node->result, *this );
    1624         if ( node->get_isType() ) {
    1625                 maybeMutate_impl( node->type, *this );
    1626         } else {
    1627                 maybeMutate_impl( node->expr, *this );
    1628         }
    1629 
    1630         MUTATE_END( Expression, node );
    1631 }
    1632 
    1633 //--------------------------------------------------------------------------
    16342304// LogicalExpr
    16352305template< typename pass_type >
    16362306void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
     2307        VISIT_START( node );
     2308
     2309        indexerScopedAccept( node->result, *this );
     2310        maybeAccept_impl   ( node->arg1  , *this );
     2311        maybeAccept_impl   ( node->arg2  , *this );
     2312
     2313        VISIT_END( node );
     2314}
     2315
     2316template< typename pass_type >
     2317void PassVisitor< pass_type >::visit( const LogicalExpr * node ) {
    16372318        VISIT_START( node );
    16382319
     
    16662347        maybeAccept_impl        ( node->arg2  , *this );
    16672348        maybeAccept_impl        ( node->arg3  , *this );
     2349
     2350        VISIT_END( node );
     2351}
     2352
     2353template< typename pass_type >
     2354void PassVisitor< pass_type >::visit( const ConditionalExpr * node ) {
     2355        VISIT_START( node );
     2356
     2357        indexerScopedAccept( node->result, *this );
     2358        maybeAccept_impl   ( node->arg1  , *this );
     2359        maybeAccept_impl   ( node->arg2  , *this );
     2360        maybeAccept_impl   ( node->arg3  , *this );
    16682361
    16692362        VISIT_END( node );
     
    16972390
    16982391template< typename pass_type >
     2392void PassVisitor< pass_type >::visit( const CommaExpr * node ) {
     2393        VISIT_START( node );
     2394
     2395        indexerScopedAccept( node->result, *this );
     2396        maybeAccept_impl   ( node->arg1  , *this );
     2397        maybeAccept_impl   ( node->arg2  , *this );
     2398
     2399        VISIT_END( node );
     2400}
     2401
     2402template< typename pass_type >
    16992403Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
    17002404        MUTATE_START( node );
     
    17212425
    17222426template< typename pass_type >
     2427void PassVisitor< pass_type >::visit( const TypeExpr * node ) {
     2428        VISIT_START( node );
     2429
     2430        indexerScopedAccept( node->result, *this );
     2431        maybeAccept_impl   ( node->type, *this );
     2432
     2433        VISIT_END( node );
     2434}
     2435
     2436template< typename pass_type >
    17232437Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
    17242438        MUTATE_START( node );
     
    17352449template< typename pass_type >
    17362450void PassVisitor< pass_type >::visit( AsmExpr * node ) {
     2451        VISIT_START( node );
     2452
     2453        indexerScopedAccept( node->result    , *this );
     2454        maybeAccept_impl   ( node->inout     , *this );
     2455        maybeAccept_impl   ( node->constraint, *this );
     2456        maybeAccept_impl   ( node->operand   , *this );
     2457
     2458        VISIT_END( node );
     2459}
     2460
     2461template< typename pass_type >
     2462void PassVisitor< pass_type >::visit( const AsmExpr * node ) {
    17372463        VISIT_START( node );
    17382464
     
    17642490        VISIT_START( node );
    17652491
    1766         indexerScopedAccept( node->result     , *this );
    1767         maybeAccept_impl   ( node->callExpr   , *this );
    1768         maybeAccept_impl   ( node->tempDecls  , *this );
    1769         maybeAccept_impl   ( node->returnDecls, *this );
    1770         maybeAccept_impl   ( node->dtors      , *this );
     2492        indexerScopedAccept( node->result    , *this );
     2493        maybeAccept_impl   ( node->callExpr  , *this );
     2494
     2495        VISIT_END( node );
     2496}
     2497
     2498template< typename pass_type >
     2499void PassVisitor< pass_type >::visit( const ImplicitCopyCtorExpr * node ) {
     2500        VISIT_START( node );
     2501
     2502        indexerScopedAccept( node->result    , *this );
     2503        maybeAccept_impl   ( node->callExpr  , *this );
    17712504
    17722505        VISIT_END( node );
     
    17772510        MUTATE_START( node );
    17782511
    1779         indexerScopedMutate( node->env        , *this );
    1780         indexerScopedMutate( node->result     , *this );
    1781         maybeMutate_impl   ( node->callExpr   , *this );
    1782         maybeMutate_impl   ( node->tempDecls  , *this );
    1783         maybeMutate_impl   ( node->returnDecls, *this );
    1784         maybeMutate_impl   ( node->dtors      , *this );
     2512        indexerScopedMutate( node->env       , *this );
     2513        indexerScopedMutate( node->result    , *this );
     2514        maybeMutate_impl   ( node->callExpr  , *this );
    17852515
    17862516        MUTATE_END( Expression, node );
     
    17912521template< typename pass_type >
    17922522void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
     2523        VISIT_START( node );
     2524
     2525        indexerScopedAccept( node->result  , *this );
     2526        maybeAccept_impl   ( node->callExpr, *this );
     2527
     2528        VISIT_END( node );
     2529}
     2530
     2531template< typename pass_type >
     2532void PassVisitor< pass_type >::visit( const ConstructorExpr * node ) {
    17932533        VISIT_START( node );
    17942534
     
    18232563
    18242564template< typename pass_type >
     2565void PassVisitor< pass_type >::visit( const CompoundLiteralExpr * node ) {
     2566        VISIT_START( node );
     2567
     2568        indexerScopedAccept( node->result     , *this );
     2569        maybeAccept_impl   ( node->initializer, *this );
     2570
     2571        VISIT_END( node );
     2572}
     2573
     2574template< typename pass_type >
    18252575Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
    18262576        MUTATE_START( node );
     
    18372587template< typename pass_type >
    18382588void PassVisitor< pass_type >::visit( RangeExpr * node ) {
     2589        VISIT_START( node );
     2590
     2591        indexerScopedAccept( node->result, *this );
     2592        maybeAccept_impl   ( node->low   , *this );
     2593        maybeAccept_impl   ( node->high  , *this );
     2594
     2595        VISIT_END( node );
     2596}
     2597
     2598template< typename pass_type >
     2599void PassVisitor< pass_type >::visit( const RangeExpr * node ) {
    18392600        VISIT_START( node );
    18402601
     
    18712632
    18722633template< typename pass_type >
     2634void PassVisitor< pass_type >::visit( const UntypedTupleExpr * node ) {
     2635        VISIT_START( node );
     2636
     2637        indexerScopedAccept( node->result, *this );
     2638        maybeAccept_impl   ( node->exprs , *this );
     2639
     2640        VISIT_END( node );
     2641}
     2642
     2643template< typename pass_type >
    18732644Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
    18742645        MUTATE_START( node );
     
    18942665
    18952666template< typename pass_type >
     2667void PassVisitor< pass_type >::visit( const TupleExpr * node ) {
     2668        VISIT_START( node );
     2669
     2670        indexerScopedAccept( node->result, *this );
     2671        maybeAccept_impl   ( node->exprs , *this );
     2672
     2673        VISIT_END( node );
     2674}
     2675
     2676template< typename pass_type >
    18962677Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
    18972678        MUTATE_START( node );
     
    19172698
    19182699template< typename pass_type >
     2700void PassVisitor< pass_type >::visit( const TupleIndexExpr * node ) {
     2701        VISIT_START( node );
     2702
     2703        indexerScopedAccept( node->result, *this );
     2704        maybeAccept_impl   ( node->tuple , *this );
     2705
     2706        VISIT_END( node );
     2707}
     2708
     2709template< typename pass_type >
    19192710Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
    19202711        MUTATE_START( node );
     
    19402731
    19412732template< typename pass_type >
     2733void PassVisitor< pass_type >::visit( const TupleAssignExpr * node ) {
     2734        VISIT_START( node );
     2735
     2736        indexerScopedAccept( node->result  , *this );
     2737        maybeAccept_impl( node->stmtExpr, *this );
     2738
     2739        VISIT_END( node );
     2740}
     2741
     2742template< typename pass_type >
    19422743Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
    19432744        MUTATE_START( node );
     
    19572758
    19582759        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    1959         ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     2760        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    19602761        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
    19612762        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     
    19702771
    19712772template< typename pass_type >
     2773void PassVisitor< pass_type >::visit( const StmtExpr * node ) {
     2774        VISIT_START( node );
     2775
     2776        // don't want statements from outer CompoundStmts to be added to this StmtExpr
     2777        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
     2778        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
     2779        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     2780
     2781        indexerScopedAccept( node->result     , *this );
     2782        maybeAccept_impl   ( node->statements , *this );
     2783        maybeAccept_impl   ( node->returnDecls, *this );
     2784        maybeAccept_impl   ( node->dtors      , *this );
     2785
     2786        VISIT_END( node );
     2787}
     2788
     2789template< typename pass_type >
    19722790Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
    19732791        MUTATE_START( node );
    19742792
    19752793        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    1976         ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     2794        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    19772795        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
    19782796        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     
    19992817
    20002818template< typename pass_type >
     2819void PassVisitor< pass_type >::visit( const UniqueExpr * node ) {
     2820        VISIT_START( node );
     2821
     2822        indexerScopedAccept( node->result, *this );
     2823        maybeAccept_impl   ( node->expr  , *this );
     2824
     2825        VISIT_END( node );
     2826}
     2827
     2828template< typename pass_type >
    20012829Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
    20022830        MUTATE_START( node );
     
    20132841template< typename pass_type >
    20142842void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) {
     2843        VISIT_START( node );
     2844
     2845        indexerScopedAccept( node->result, *this );
     2846        maybeAccept_impl   ( node->expr  , *this );
     2847        // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
     2848
     2849        VISIT_END( node );
     2850}
     2851
     2852template< typename pass_type >
     2853void PassVisitor< pass_type >::visit( const UntypedInitExpr * node ) {
    20152854        VISIT_START( node );
    20162855
     
    20482887
    20492888template< typename pass_type >
     2889void PassVisitor< pass_type >::visit( const InitExpr * node ) {
     2890        VISIT_START( node );
     2891
     2892        indexerScopedAccept( node->result, *this );
     2893        maybeAccept_impl   ( node->expr  , *this );
     2894        maybeAccept_impl   ( node->designation, *this );
     2895
     2896        VISIT_END( node );
     2897}
     2898
     2899template< typename pass_type >
    20502900Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) {
    20512901        MUTATE_START( node );
     
    20662916
    20672917        indexerScopedAccept( node->result, *this );
    2068         maybeAccept_impl( node->expr, *this );
     2918        maybeAccept_impl   ( node->expr, *this );
     2919        // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
     2920
     2921        VISIT_END( node );
     2922}
     2923
     2924template< typename pass_type >
     2925void PassVisitor< pass_type >::visit( const DeletedExpr * node ) {
     2926        VISIT_START( node );
     2927
     2928        indexerScopedAccept( node->result, *this );
     2929        maybeAccept_impl   ( node->expr, *this );
    20692930        // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
    20702931
     
    20842945
    20852946//--------------------------------------------------------------------------
     2947// DefaultArgExpr
     2948template< typename pass_type >
     2949void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) {
     2950        VISIT_START( node );
     2951
     2952        indexerScopedAccept( node->result, *this );
     2953        maybeAccept_impl   ( node->expr, *this );
     2954
     2955        VISIT_END( node );
     2956}
     2957
     2958template< typename pass_type >
     2959void PassVisitor< pass_type >::visit( const DefaultArgExpr * node ) {
     2960        VISIT_START( node );
     2961
     2962        indexerScopedAccept( node->result, *this );
     2963        maybeAccept_impl   ( node->expr, *this );
     2964
     2965        VISIT_END( node );
     2966}
     2967
     2968template< typename pass_type >
     2969Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) {
     2970        MUTATE_START( node );
     2971
     2972        indexerScopedMutate( node->env, *this );
     2973        indexerScopedMutate( node->result, *this );
     2974        maybeMutate_impl( node->expr, *this );
     2975
     2976        MUTATE_END( Expression, node );
     2977}
     2978
     2979//--------------------------------------------------------------------------
    20862980// GenericExpr
    20872981template< typename pass_type >
     
    20922986        maybeAccept_impl( node->control, *this );
    20932987        for ( GenericExpr::Association & assoc : node->associations ) {
     2988                indexerScopedAccept( assoc.type, *this );
     2989                maybeAccept_impl( assoc.expr, *this );
     2990        }
     2991
     2992        VISIT_END( node );
     2993}
     2994
     2995template< typename pass_type >
     2996void PassVisitor< pass_type >::visit( const GenericExpr * node ) {
     2997        VISIT_START( node );
     2998
     2999        indexerScopedAccept( node->result, *this );
     3000        maybeAccept_impl( node->control, *this );
     3001        for ( const GenericExpr::Association & assoc : node->associations ) {
    20943002                indexerScopedAccept( assoc.type, *this );
    20953003                maybeAccept_impl( assoc.expr, *this );
     
    21263034
    21273035template< typename pass_type >
     3036void PassVisitor< pass_type >::visit( const VoidType * node ) {
     3037        VISIT_START( node );
     3038
     3039        maybeAccept_impl( node->forall, *this );
     3040
     3041        VISIT_END( node );
     3042}
     3043
     3044template< typename pass_type >
    21283045Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
    21293046        MUTATE_START( node );
     
    21383055template< typename pass_type >
    21393056void PassVisitor< pass_type >::visit( BasicType * node ) {
     3057        VISIT_START( node );
     3058
     3059        maybeAccept_impl( node->forall, *this );
     3060
     3061        VISIT_END( node );
     3062}
     3063
     3064template< typename pass_type >
     3065void PassVisitor< pass_type >::visit( const BasicType * node ) {
    21403066        VISIT_START( node );
    21413067
     
    21683094
    21693095template< typename pass_type >
     3096void PassVisitor< pass_type >::visit( const PointerType * node ) {
     3097        VISIT_START( node );
     3098
     3099        maybeAccept_impl( node->forall, *this );
     3100        // xxx - should PointerType visit/mutate dimension?
     3101        maybeAccept_impl( node->base, *this );
     3102
     3103        VISIT_END( node );
     3104}
     3105
     3106template< typename pass_type >
    21703107Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
    21713108        MUTATE_START( node );
     
    21923129
    21933130template< typename pass_type >
     3131void PassVisitor< pass_type >::visit( const ArrayType * node ) {
     3132        VISIT_START( node );
     3133
     3134        maybeAccept_impl( node->forall, *this );
     3135        maybeAccept_impl( node->dimension, *this );
     3136        maybeAccept_impl( node->base, *this );
     3137
     3138        VISIT_END( node );
     3139}
     3140
     3141template< typename pass_type >
    21943142Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
    21953143        MUTATE_START( node );
     
    22153163
    22163164template< typename pass_type >
     3165void PassVisitor< pass_type >::visit( const ReferenceType * node ) {
     3166        VISIT_START( node );
     3167
     3168        maybeAccept_impl( node->forall, *this );
     3169        maybeAccept_impl( node->base, *this );
     3170
     3171        VISIT_END( node );
     3172}
     3173
     3174template< typename pass_type >
    22173175Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
    22183176        MUTATE_START( node );
     
    22203178        maybeMutate_impl( node->forall, *this );
    22213179        maybeMutate_impl( node->base, *this );
     3180
     3181        MUTATE_END( Type, node );
     3182}
     3183
     3184//--------------------------------------------------------------------------
     3185// QualifiedType
     3186template< typename pass_type >
     3187void PassVisitor< pass_type >::visit( QualifiedType * node ) {
     3188        VISIT_START( node );
     3189
     3190        maybeAccept_impl( node->forall, *this );
     3191        maybeAccept_impl( node->parent, *this );
     3192        maybeAccept_impl( node->child, *this );
     3193
     3194        VISIT_END( node );
     3195}
     3196
     3197template< typename pass_type >
     3198void PassVisitor< pass_type >::visit( const QualifiedType * node ) {
     3199        VISIT_START( node );
     3200
     3201        maybeAccept_impl( node->forall, *this );
     3202        maybeAccept_impl( node->parent, *this );
     3203        maybeAccept_impl( node->child, *this );
     3204
     3205        VISIT_END( node );
     3206}
     3207
     3208template< typename pass_type >
     3209Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) {
     3210        MUTATE_START( node );
     3211
     3212        maybeMutate_impl( node->forall, *this );
     3213        maybeMutate_impl( node->parent, *this );
     3214        maybeMutate_impl( node->child, *this );
    22223215
    22233216        MUTATE_END( Type, node );
     
    22383231
    22393232template< typename pass_type >
     3233void PassVisitor< pass_type >::visit( const FunctionType * node ) {
     3234        VISIT_START( node );
     3235
     3236        maybeAccept_impl( node->forall, *this );
     3237        maybeAccept_impl( node->returnVals, *this );
     3238        maybeAccept_impl( node->parameters, *this );
     3239
     3240        VISIT_END( node );
     3241}
     3242
     3243template< typename pass_type >
    22403244Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
    22413245        MUTATE_START( node );
     
    22663270
    22673271template< typename pass_type >
     3272void PassVisitor< pass_type >::visit( const StructInstType * node ) {
     3273        VISIT_START( node );
     3274
     3275        indexerAddStruct( node->name );
     3276
     3277        {
     3278                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     3279                maybeAccept_impl( node->forall    , *this );
     3280                maybeAccept_impl( node->parameters, *this );
     3281        }
     3282
     3283        VISIT_END( node );
     3284}
     3285
     3286template< typename pass_type >
    22683287Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
    22693288        MUTATE_START( node );
     
    22983317
    22993318template< typename pass_type >
     3319void PassVisitor< pass_type >::visit( const UnionInstType * node ) {
     3320        VISIT_START( node );
     3321
     3322        indexerAddStruct( node->name );
     3323
     3324        {
     3325                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     3326                maybeAccept_impl( node->forall    , *this );
     3327                maybeAccept_impl( node->parameters, *this );
     3328        }
     3329
     3330        VISIT_END( node );
     3331}
     3332
     3333template< typename pass_type >
    23003334Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
    23013335        MUTATE_START( node );
     
    23253359
    23263360template< typename pass_type >
     3361void PassVisitor< pass_type >::visit( const EnumInstType * node ) {
     3362        VISIT_START( node );
     3363
     3364        maybeAccept_impl( node->forall, *this );
     3365        maybeAccept_impl( node->parameters, *this );
     3366
     3367        VISIT_END( node );
     3368}
     3369
     3370template< typename pass_type >
    23273371Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
    23283372        MUTATE_START( node );
     
    23473391
    23483392template< typename pass_type >
     3393void PassVisitor< pass_type >::visit( const TraitInstType * node ) {
     3394        VISIT_START( node );
     3395
     3396        maybeAccept_impl( node->forall    , *this );
     3397        maybeAccept_impl( node->parameters, *this );
     3398
     3399        VISIT_END( node );
     3400}
     3401
     3402template< typename pass_type >
    23493403Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
    23503404        MUTATE_START( node );
     
    23603414template< typename pass_type >
    23613415void PassVisitor< pass_type >::visit( TypeInstType * node ) {
     3416        VISIT_START( node );
     3417
     3418        maybeAccept_impl( node->forall    , *this );
     3419        maybeAccept_impl( node->parameters, *this );
     3420
     3421        VISIT_END( node );
     3422}
     3423
     3424template< typename pass_type >
     3425void PassVisitor< pass_type >::visit( const TypeInstType * node ) {
    23623426        VISIT_START( node );
    23633427
     
    23923456
    23933457template< typename pass_type >
     3458void PassVisitor< pass_type >::visit( const TupleType * node ) {
     3459        VISIT_START( node );
     3460
     3461        maybeAccept_impl( node->forall, *this );
     3462        maybeAccept_impl( node->types, *this );
     3463        maybeAccept_impl( node->members, *this );
     3464
     3465        VISIT_END( node );
     3466}
     3467
     3468template< typename pass_type >
    23943469Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
    23953470        MUTATE_START( node );
     
    24063481template< typename pass_type >
    24073482void PassVisitor< pass_type >::visit( TypeofType * node ) {
     3483        VISIT_START( node );
     3484
     3485        assert( node->expr );
     3486        maybeAccept_impl( node->expr, *this );
     3487
     3488        VISIT_END( node );
     3489}
     3490
     3491template< typename pass_type >
     3492void PassVisitor< pass_type >::visit( const TypeofType * node ) {
    24083493        VISIT_START( node );
    24093494
     
    24423527
    24433528template< typename pass_type >
     3529void PassVisitor< pass_type >::visit( const AttrType * node ) {
     3530        VISIT_START( node );
     3531
     3532        if ( node->isType ) {
     3533                assert( node->type );
     3534                maybeAccept_impl( node->type, *this );
     3535        } else {
     3536                assert( node->expr );
     3537                maybeAccept_impl( node->expr, *this );
     3538        } // if
     3539
     3540        VISIT_END( node );
     3541}
     3542
     3543template< typename pass_type >
    24443544Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
    24453545        MUTATE_START( node );
     
    24683568
    24693569template< typename pass_type >
     3570void PassVisitor< pass_type >::visit( const VarArgsType * node ) {
     3571        VISIT_START( node );
     3572
     3573        maybeAccept_impl( node->forall, *this );
     3574
     3575        VISIT_END( node );
     3576}
     3577
     3578template< typename pass_type >
    24703579Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
    24713580        MUTATE_START( node );
     
    24883597
    24893598template< typename pass_type >
     3599void PassVisitor< pass_type >::visit( const ZeroType * node ) {
     3600        VISIT_START( node );
     3601
     3602        maybeAccept_impl( node->forall, *this );
     3603
     3604        VISIT_END( node );
     3605}
     3606
     3607template< typename pass_type >
    24903608Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
    24913609        MUTATE_START( node );
     
    25083626
    25093627template< typename pass_type >
     3628void PassVisitor< pass_type >::visit( const OneType * node ) {
     3629        VISIT_START( node );
     3630
     3631        maybeAccept_impl( node->forall, *this );
     3632
     3633        VISIT_END( node );
     3634}
     3635
     3636template< typename pass_type >
    25103637Type * PassVisitor< pass_type >::mutate( OneType * node ) {
    25113638        MUTATE_START( node );
     
    25173644
    25183645//--------------------------------------------------------------------------
     3646// GlobalScopeType
     3647template< typename pass_type >
     3648void PassVisitor< pass_type >::visit( GlobalScopeType * node ) {
     3649        VISIT_START( node );
     3650
     3651        maybeAccept_impl( node->forall, *this );
     3652
     3653        VISIT_END( node );
     3654}
     3655
     3656template< typename pass_type >
     3657void PassVisitor< pass_type >::visit( const GlobalScopeType * node ) {
     3658        VISIT_START( node );
     3659
     3660        maybeAccept_impl( node->forall, *this );
     3661
     3662        VISIT_END( node );
     3663}
     3664
     3665template< typename pass_type >
     3666Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) {
     3667        MUTATE_START( node );
     3668
     3669        maybeMutate_impl( node->forall, *this );
     3670
     3671        MUTATE_END( Type, node );
     3672}
     3673
     3674//--------------------------------------------------------------------------
    25193675// Designation
    25203676template< typename pass_type >
     
    25283684
    25293685template< typename pass_type >
     3686void PassVisitor< pass_type >::visit( const Designation * node ) {
     3687        VISIT_START( node );
     3688
     3689        maybeAccept_impl( node->designators, *this );
     3690
     3691        VISIT_END( node );
     3692}
     3693
     3694template< typename pass_type >
    25303695Designation * PassVisitor< pass_type >::mutate( Designation * node ) {
    25313696        MUTATE_START( node );
     
    25483713
    25493714template< typename pass_type >
     3715void PassVisitor< pass_type >::visit( const SingleInit * node ) {
     3716        VISIT_START( node );
     3717
     3718        visitExpression( node->value );
     3719
     3720        VISIT_END( node );
     3721}
     3722
     3723template< typename pass_type >
    25503724Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) {
    25513725        MUTATE_START( node );
     
    25603734template< typename pass_type >
    25613735void PassVisitor< pass_type >::visit( ListInit * node ) {
     3736        VISIT_START( node );
     3737
     3738        maybeAccept_impl( node->designations, *this );
     3739        maybeAccept_impl( node->initializers, *this );
     3740
     3741        VISIT_END( node );
     3742}
     3743
     3744template< typename pass_type >
     3745void PassVisitor< pass_type >::visit( const ListInit * node ) {
    25623746        VISIT_START( node );
    25633747
     
    25923776
    25933777template< typename pass_type >
     3778void PassVisitor< pass_type >::visit( const ConstructorInit * node ) {
     3779        VISIT_START( node );
     3780
     3781        maybeAccept_impl( node->ctor, *this );
     3782        maybeAccept_impl( node->dtor, *this );
     3783        maybeAccept_impl( node->init, *this );
     3784
     3785        VISIT_END( node );
     3786}
     3787
     3788template< typename pass_type >
    25943789Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
    25953790        MUTATE_START( node );
     
    26033798
    26043799//--------------------------------------------------------------------------
    2605 // Subrange
    2606 template< typename pass_type >
    2607 void PassVisitor< pass_type >::visit( Subrange * node ) {
    2608         VISIT_START( node );
    2609 
    2610         VISIT_END( node );
    2611 }
    2612 
    2613 template< typename pass_type >
    2614 Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
    2615         MUTATE_START( node );
    2616 
    2617         MUTATE_END( Subrange, node );
    2618 }
    2619 
    2620 //--------------------------------------------------------------------------
    26213800// Attribute
    26223801template< typename pass_type >
     
    26283807
    26293808template< typename pass_type >
     3809void PassVisitor< pass_type >::visit( const Constant * node ) {
     3810        VISIT_START( node );
     3811
     3812        VISIT_END( node );
     3813}
     3814
     3815template< typename pass_type >
    26303816Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
    26313817        MUTATE_START( node );
     
    26383824template< typename pass_type >
    26393825void PassVisitor< pass_type >::visit( Attribute * node ) {
     3826        VISIT_START( node );
     3827
     3828        maybeAccept_impl( node->parameters, *this );
     3829
     3830        VISIT_END( node );
     3831}
     3832
     3833template< typename pass_type >
     3834void PassVisitor< pass_type >::visit( const Attribute * node ) {
    26403835        VISIT_START( node );
    26413836
     
    26693864        MUTATE_END( TypeSubstitution, node );
    26703865}
     3866
     3867#undef VISIT_START
     3868#undef VISIT_END
     3869
     3870#undef MUTATE_START
     3871#undef MUTATE_END
Note: See TracChangeset for help on using the changeset viewer.