Ignore:
File:
1 edited

Legend:

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

    r712348a r2f86ddf  
    2020
    2121#define MUTATE_END( type, node )                \
    22         auto __return = call_postmutate< type * >( node ); \
    23         assert( __return ); \
    24         return __return;
     22        return call_postmutate< type * >( node ); \
    2523
    2624
     
    6967        SemanticErrorException errors;
    7068
    71         pass_visitor_stats.depth++;
    72         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    73         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    7469        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    75 
    76 
    7770                // splice in new declarations after previous decl
    7871                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     
    9083                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    9184        }
    92         pass_visitor_stats.depth--;
    9385        if ( ! errors.isEmpty() ) {
    9486                throw errors;
     
    10294        SemanticErrorException errors;
    10395
    104         pass_visitor_stats.depth++;
    105         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    106         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    10796        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    10897                // splice in new declarations after previous decl
     
    120109                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    121110        }
    122         pass_visitor_stats.depth--;
    123111        if ( ! errors.isEmpty() ) {
    124112                throw errors;
     
    138126        if ( ! visitor.get_visit_children() ) return;
    139127        SemanticErrorException errors;
    140 
    141         pass_visitor_stats.depth++;
    142         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    143         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    144128        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    145129                try {
     
    151135                }
    152136        }
    153         pass_visitor_stats.depth--;
    154137        if ( ! errors.isEmpty() ) {
    155138                throw errors;
     
    168151template< typename Container, typename pass_type >
    169152inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) {
    170 
    171153        if ( ! mutator.get_visit_children() ) return;
    172154        SemanticErrorException errors;
    173 
    174         pass_visitor_stats.depth++;
    175         pass_visitor_stats.max->push(pass_visitor_stats.depth);
    176         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    177155        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    178156                try {
     
    185163                } // try
    186164        } // for
    187         pass_visitor_stats.depth--;
    188165        if ( ! errors.isEmpty() ) {
    189166                throw errors;
     
    208185        DeclList_t* afterDecls  = get_afterDecls();
    209186
    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);
    213187        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    214188
     
    218192                try {
    219193                        func( *i );
    220                         assert( *i );
    221194                        assert(( empty( beforeStmts ) && empty( afterStmts ))
    222195                            || ( empty( beforeDecls ) && empty( afterDecls )) );
     
    229202                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    230203        }
    231         pass_visitor_stats.depth--;
    232204
    233205        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
     
    257229
    258230        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    259         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
     231        ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
    260232        ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
    261233        ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
     
    18061778        VISIT_START( node );
    18071779
    1808         indexerScopedAccept( node->result     , *this );
    1809         maybeAccept_impl   ( node->callExpr   , *this );
    1810         maybeAccept_impl   ( node->tempDecls  , *this );
    1811         maybeAccept_impl   ( node->returnDecls, *this );
    1812         maybeAccept_impl   ( node->dtors      , *this );
     1780        indexerScopedAccept( node->result    , *this );
     1781        maybeAccept_impl   ( node->callExpr  , *this );
    18131782
    18141783        VISIT_END( node );
     
    18191788        MUTATE_START( node );
    18201789
    1821         indexerScopedMutate( node->env        , *this );
    1822         indexerScopedMutate( node->result     , *this );
    1823         maybeMutate_impl   ( node->callExpr   , *this );
    1824         maybeMutate_impl   ( node->tempDecls  , *this );
    1825         maybeMutate_impl   ( node->returnDecls, *this );
    1826         maybeMutate_impl   ( node->dtors      , *this );
     1790        indexerScopedMutate( node->env       , *this );
     1791        indexerScopedMutate( node->result    , *this );
     1792        maybeMutate_impl   ( node->callExpr  , *this );
    18271793
    18281794        MUTATE_END( Expression, node );
     
    19991965
    20001966        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    2001         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
     1967        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
    20021968        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
    20031969        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     
    20161982
    20171983        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    2018         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
     1984        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
    20191985        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
    20201986        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     
    27122678
    27132679//--------------------------------------------------------------------------
     2680// Subrange
     2681template< typename pass_type >
     2682void PassVisitor< pass_type >::visit( Subrange * node ) {
     2683        VISIT_START( node );
     2684
     2685        VISIT_END( node );
     2686}
     2687
     2688template< typename pass_type >
     2689Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
     2690        MUTATE_START( node );
     2691
     2692        MUTATE_END( Subrange, node );
     2693}
     2694
     2695//--------------------------------------------------------------------------
    27142696// Attribute
    27152697template< typename pass_type >
Note: See TracChangeset for help on using the changeset viewer.