Ignore:
File:
1 edited

Legend:

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

    r6ca154b r62423350  
    33#define VISIT_START( node )                     \
    44        __attribute__((unused))                   \
    5         const auto & guard = init_guard();        \
     5        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
    66        bool visit_children = true;               \
    77        set_visit_children( visit_children );   \
     
    1515#define MUTATE_START( node )                    \
    1616        __attribute__((unused))                   \
    17         const auto & guard = init_guard();        \
     17        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
    1818        bool visit_children = true;               \
    1919        set_visit_children( visit_children );   \
     
    6868        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    6969                // splice in new declarations after previous decl
    70                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 
     70                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
    7171
    7272                if ( i == decls.end() ) break;
     
    8888        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    8989                // splice in new declarations after previous decl
    90                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 
     90                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
    9191
    9292                if ( i == decls.end() ) break;
     
    104104void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
    105105        SemanticError errors;
     106
     107        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
     108        ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
     109        ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
     110        ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
     111        ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
    106112
    107113        StmtList_t* beforeStmts = get_beforeStmts();
     
    181187Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
    182188        return handleStatement( stmt, [this]( Statement * stmt ) {
    183                 maybeAccept( stmt, *this ); 
     189                maybeAccept( stmt, *this );
    184190                return stmt;
    185191        });
     
    212218                expr->accept( *this );
    213219                return expr;
    214         });             
     220        });
    215221}
    216222
     
    565571        VISIT_START( node );
    566572
     573        // maybeAccept( node->get_env(), *this );
     574        maybeAccept( node->get_result(), *this );
     575
    567576        for ( auto expr : node->get_args() ) {
    568577                visitExpression( expr );
     
    575584Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
    576585        MUTATE_START( node );
     586
     587        node->set_env( maybeMutate( node->get_env(), *this ) );
     588        node->set_result( maybeMutate( node->get_result(), *this ) );
    577589
    578590        for ( auto& expr : node->get_args() ) {
Note: See TracChangeset for help on using the changeset viewer.