Ignore:
File:
1 edited

Legend:

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

    r61d9b4b rcc32d83  
    404404                        indexerAddId( &func );
    405405                        maybeAccept_impl( node->type, *this );
    406                         // function body needs to have the same scope as parameters - CompoundStmt will not enter
    407                         // a new scope if inFunction is true
    408                         ValueGuard< bool > oldInFunction( inFunction );
    409                         inFunction = true;
    410406                        maybeAccept_impl( node->statements, *this );
    411407                        maybeAccept_impl( node->attributes, *this );
     
    438434                        indexerAddId( &func );
    439435                        maybeMutate_impl( node->type, *this );
    440                         // function body needs to have the same scope as parameters - CompoundStmt will not enter
    441                         // a new scope if inFunction is true
    442                         ValueGuard< bool > oldInFunction( inFunction );
    443                         inFunction = true;
    444436                        maybeMutate_impl( node->statements, *this );
    445437                        maybeMutate_impl( node->attributes, *this );
     
    720712        VISIT_START( node );
    721713        {
    722                 // do not enter a new scope if inFunction is true - needs to check old state before the assignment
    723                 ValueGuard< bool > oldInFunction( inFunction );
    724                 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
     714                auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    725715                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    726                 inFunction = false;
    727716                visitStatementList( node->kids );
    728717        }
     
    734723        MUTATE_START( node );
    735724        {
    736                 // do not enter a new scope if inFunction is true - needs to check old state before the assignment
    737                 ValueGuard< bool > oldInFunction( inFunction );
    738                 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
     725                auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    739726                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    740                 inFunction = false;
    741727                mutateStatementList( node->kids );
    742728        }
     
    842828        VISIT_START( node );
    843829
    844         {
    845                 // while statements introduce a level of scope (for the initialization)
    846                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    847                 maybeAccept_impl( node->initialization, *this );
    848                 visitExpression ( node->condition );
    849                 node->body = visitStatement( node->body );
    850         }
     830        visitExpression( node->condition );
     831        node->body = visitStatement( node->body );
    851832
    852833        VISIT_END( node );
     
    857838        MUTATE_START( node );
    858839
    859         {
    860                 // while statements introduce a level of scope (for the initialization)
    861                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    862                 maybeMutate_impl( node->initialization, *this );
    863                 node->condition = mutateExpression( node->condition );
    864                 node->body      = mutateStatement ( node->body      );
    865         }
    866 
     840        node->condition = mutateExpression( node->condition );
     841        node->body      = mutateStatement ( node->body      );
    867842
    868843        MUTATE_END( Statement, node );
     
    20982073
    20992074//--------------------------------------------------------------------------
    2100 // DefaultArgExpr
    2101 template< typename pass_type >
    2102 void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) {
    2103         VISIT_START( node );
    2104 
    2105         indexerScopedAccept( node->result, *this );
    2106         maybeAccept_impl( node->expr, *this );
    2107 
    2108         VISIT_END( node );
    2109 }
    2110 
    2111 template< typename pass_type >
    2112 Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) {
    2113         MUTATE_START( node );
    2114 
    2115         indexerScopedMutate( node->env, *this );
    2116         indexerScopedMutate( node->result, *this );
    2117         maybeMutate_impl( node->expr, *this );
    2118 
    2119         MUTATE_END( Expression, node );
    2120 }
    2121 
    2122 //--------------------------------------------------------------------------
    2123 // GenericExpr
    2124 template< typename pass_type >
    2125 void PassVisitor< pass_type >::visit( GenericExpr * node ) {
    2126         VISIT_START( node );
    2127 
    2128         indexerScopedAccept( node->result, *this );
    2129         maybeAccept_impl( node->control, *this );
    2130         for ( GenericExpr::Association & assoc : node->associations ) {
    2131                 indexerScopedAccept( assoc.type, *this );
    2132                 maybeAccept_impl( assoc.expr, *this );
    2133         }
    2134 
    2135         VISIT_END( node );
    2136 }
    2137 
    2138 template< typename pass_type >
    2139 Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) {
    2140         MUTATE_START( node );
    2141 
    2142         indexerScopedMutate( node->env, *this );
    2143         indexerScopedMutate( node->result, *this );
    2144         maybeMutate_impl( node->control, *this );
    2145         for ( GenericExpr::Association & assoc : node->associations ) {
    2146                 indexerScopedMutate( assoc.type, *this );
    2147                 maybeMutate_impl( assoc.expr, *this );
    2148         }
    2149 
    2150         MUTATE_END( Expression, node );
    2151 }
    2152 
    2153 //--------------------------------------------------------------------------
    21542075// VoidType
    21552076template< typename pass_type >
Note: See TracChangeset for help on using the changeset viewer.