Ignore:
Timestamp:
Mar 28, 2022, 10:41:45 AM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
8e819a9
Parents:
f5bace8
Message:

Added StmtClause? and converted the existing nodes that should be clauses.

File:
1 edited

Legend:

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

    rf5bace8 r400b8be  
    893893        if ( __visit_children() ) {
    894894                maybe_accept( node, &SwitchStmt::cond  );
    895                 maybe_accept( node, &SwitchStmt::stmts );
     895                maybe_accept( node, &SwitchStmt::cases );
    896896        }
    897897
     
    900900
    901901//--------------------------------------------------------------------------
    902 // CaseStmt
    903 template< typename core_t >
    904 const ast::Stmt * ast::Pass< core_t >::visit( const ast::CaseStmt * node ) {
    905         VISIT_START( node );
    906 
    907         if ( __visit_children() ) {
    908                 maybe_accept( node, &CaseStmt::cond  );
    909                 maybe_accept( node, &CaseStmt::stmts );
    910         }
    911 
    912         VISIT_END( Stmt, node );
     902// CaseClause
     903template< typename core_t >
     904const ast::CaseClause * ast::Pass< core_t >::visit( const ast::CaseClause * node ) {
     905        VISIT_START( node );
     906
     907        if ( __visit_children() ) {
     908                maybe_accept( node, &CaseClause::cond  );
     909                maybe_accept( node, &CaseClause::stmts );
     910        }
     911
     912        VISIT_END( CaseClause, node );
    913913}
    914914
     
    964964
    965965//--------------------------------------------------------------------------
    966 // CatchStmt
    967 template< typename core_t >
    968 const ast::Stmt * ast::Pass< core_t >::visit( const ast::CatchStmt * node ) {
     966// CatchClause
     967template< typename core_t >
     968const ast::CatchClause * ast::Pass< core_t >::visit( const ast::CatchClause * node ) {
    969969        VISIT_START( node );
    970970
     
    972972                // catch statements introduce a level of scope (for the caught exception)
    973973                guard_symtab guard { *this };
    974                 maybe_accept( node, &CatchStmt::decl );
    975                 maybe_accept( node, &CatchStmt::cond );
    976                 maybe_accept_as_compound( node, &CatchStmt::body );
    977         }
    978 
    979         VISIT_END( Stmt, node );
    980 }
    981 
    982 //--------------------------------------------------------------------------
    983 // FinallyStmt
    984 template< typename core_t >
    985 const ast::Stmt * ast::Pass< core_t >::visit( const ast::FinallyStmt * node ) {
    986         VISIT_START( node );
    987 
    988         if ( __visit_children() ) {
    989                 maybe_accept( node, &FinallyStmt::body );
    990         }
    991 
    992         VISIT_END( Stmt, node );
     974                maybe_accept( node, &CatchClause::decl );
     975                maybe_accept( node, &CatchClause::cond );
     976                maybe_accept_as_compound( node, &CatchClause::body );
     977        }
     978
     979        VISIT_END( CatchClause, node );
     980}
     981
     982//--------------------------------------------------------------------------
     983// FinallyClause
     984template< typename core_t >
     985const ast::FinallyClause * ast::Pass< core_t >::visit( const ast::FinallyClause * node ) {
     986        VISIT_START( node );
     987
     988        if ( __visit_children() ) {
     989                maybe_accept( node, &FinallyClause::body );
     990        }
     991
     992        VISIT_END( FinallyClause, node );
    993993}
    994994
Note: See TracChangeset for help on using the changeset viewer.