Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    racd80b4 r10a1225  
    791791
    792792//--------------------------------------------------------------------------
     793// CatchStmt
     794template< typename pass_t >
     795const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CatchStmt * node ) {
     796        VISIT_START( node );
     797
     798        VISIT({
     799                // catch statements introduce a level of scope (for the caught exception)
     800                guard_indexer guard { *this };
     801                maybe_accept( node, &CatchStmt::decl );
     802                maybe_accept( node, &CatchStmt::cond );
     803                maybe_accept( node, &CatchStmt::body );
     804        })
     805
     806        VISIT_END( Stmt, node );
     807}
     808
     809//--------------------------------------------------------------------------
     810// FinallyStmt
     811template< typename pass_t >
     812const ast::Stmt * ast::Pass< pass_t >::visit( const ast::FinallyStmt * node ) {
     813        VISIT_START( node );
     814
     815        VISIT(
     816                maybe_accept( node, &FinallyStmt::body );
     817        )
     818
     819        VISIT_END( Stmt, node );
     820}
     821
     822//--------------------------------------------------------------------------
     823// WaitForStmt
     824template< typename pass_t >
     825const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WaitForStmt * node ) {
     826        VISIT_START( node );
     827                // for( auto & clause : node->clauses ) {
     828                //      maybeAccept_impl( clause.target.function, *this );
     829                //      maybeAccept_impl( clause.target.arguments, *this );
     830
     831                //      maybeAccept_impl( clause.statement, *this );
     832                //      maybeAccept_impl( clause.condition, *this );
     833                // }
     834
     835        #define maybe_accept(field) \
     836                if(node->field) { \
     837                        auto nval = call_accept( node->field ); \
     838                        if(nval != node->field ) { \
     839                                auto nparent = mutate(node); \
     840                                nparent->field = nval; \
     841                                node = nparent; \
     842                        } \
     843                }
     844
     845        VISIT(
     846                maybe_accept( timeout.time );
     847                maybe_accept( timeout.stmt );
     848                maybe_accept( timeout.cond );
     849                maybe_accept( orElse.stmt  );
     850                maybe_accept( orElse.cond  );
     851        )
     852
     853        #undef maybe_accept
     854
     855        VISIT_END( Stmt, node );
     856}
     857
     858//--------------------------------------------------------------------------
     859// WithStmt
     860template< typename pass_t >
     861const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WithStmt * node ) {
     862        VISIT_START( node );
     863
     864        VISIT(
     865                maybe_accept( node, &WithStmt::exprs );
     866                {
     867                        // catch statements introduce a level of scope (for the caught exception)
     868                        guard_indexer guard { *this };
     869                        __pass::indexer::addWith( pass, 0, node->exprs, node );
     870                        maybe_accept( node, &WithStmt::stmt );
     871                }
     872        )
     873        VISIT_END( Stmt, node );
     874}
     875
     876//--------------------------------------------------------------------------
     877// NullStmt
     878template< typename pass_t >
     879const ast::NullStmt * ast::Pass< pass_t >::visit( const ast::NullStmt * node ) {
     880        VISIT_START( node );
     881        VISIT_END( NullStmt, node );
     882}
     883
     884//--------------------------------------------------------------------------
     885// DeclStmt
     886template< typename pass_t >
     887const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DeclStmt * node ) {
     888        VISIT_START( node );
     889
     890        VISIT(
     891                maybe_accept( node, &DeclStmt::decl );
     892        )
     893
     894        VISIT_END( Stmt, node );
     895}
     896
     897//--------------------------------------------------------------------------
     898// ImplicitCtorDtorStmt
     899template< typename pass_t >
     900const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ImplicitCtorDtorStmt * node ) {
     901        VISIT_START( node );
     902
     903        // For now this isn't visited, it is unclear if this causes problem
     904        // if all tests are known to pass, remove this code
     905        // VISIT(
     906        //      maybe_accept( node, &ImplicitCtorDtorStmt::callStmt );
     907        // )
     908
     909        VISIT_END( Stmt, node );
     910}
     911
     912
     913
     914
     915
     916
     917//--------------------------------------------------------------------------
    793918// SingleInit
    794919template< typename pass_t >
Note: See TracChangeset for help on using the changeset viewer.