Ignore:
File:
1 edited

Legend:

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

    rc671112 re61207e7  
    1919#include <type_traits>
    2020#include <unordered_map>
    21 
    22 #include "AST/TypeSubstitution.hpp"
    2321
    2422#define VISIT_START( node ) \
     
    464462        VISIT({
    465463                guard_indexer guard { * this };
    466                 maybe_accept( node, &StructDecl::params );
    467                 maybe_accept( node, &StructDecl::members    );
     464                maybe_accept( node, &StructDecl::params  );
     465                maybe_accept( node, &StructDecl::members );
    468466        })
    469467
     
    485483        VISIT({
    486484                guard_indexer guard { * this };
    487                 maybe_accept( node, &UnionDecl::params );
    488                 maybe_accept( node, &UnionDecl::members    );
     485                maybe_accept( node, &UnionDecl::params  );
     486                maybe_accept( node, &UnionDecl::members );
    489487        })
    490488
     
    504502        VISIT(
    505503                // unlike structs, traits, and unions, enums inject their members into the global scope
    506                 maybe_accept( node, &EnumDecl::params );
    507                 maybe_accept( node, &EnumDecl::members    );
     504                maybe_accept( node, &EnumDecl::params  );
     505                maybe_accept( node, &EnumDecl::members );
    508506        )
    509507
     
    519517        VISIT({
    520518                guard_indexer guard { *this };
    521                 maybe_accept( node, &TraitDecl::params );
    522                 maybe_accept( node, &TraitDecl::members    );
     519                maybe_accept( node, &TraitDecl::params  );
     520                maybe_accept( node, &TraitDecl::members );
    523521        })
    524522
     
    537535                guard_indexer guard { *this };
    538536                maybe_accept( node, &TypeDecl::params );
    539                 maybe_accept( node, &TypeDecl::base       );
     537                maybe_accept( node, &TypeDecl::base   );
    540538        })
    541539
     
    566564                guard_indexer guard { *this };
    567565                maybe_accept( node, &TypedefDecl::params );
    568                 maybe_accept( node, &TypedefDecl::base       );
     566                maybe_accept( node, &TypedefDecl::base   );
    569567        })
    570568
     
    690688                maybe_accept( node, &WhileStmt::body  );
    691689        })
     690
     691        VISIT_END( Stmt, node );
     692}
     693
     694//--------------------------------------------------------------------------
     695// ForStmt
     696template< typename pass_t >
     697const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ForStmt * node ) {
     698        VISIT_START( node );
     699
     700        VISIT({
     701                // for statements introduce a level of scope (for the initialization)
     702                guard_indexer guard { *this };
     703                maybe_accept( node, &ForStmt::inits );
     704                maybe_accept( node, &ForStmt::cond  );
     705                maybe_accept( node, &ForStmt::inc   );
     706                maybe_accept( node, &ForStmt::body  );
     707        })
     708
     709        VISIT_END( Stmt, node );
     710}
     711
     712//--------------------------------------------------------------------------
     713// SwitchStmt
     714template< typename pass_t >
     715const ast::Stmt * ast::Pass< pass_t >::visit( const ast::SwitchStmt * node ) {
     716        VISIT_START( node );
     717
     718        VISIT(
     719                maybe_accept( node, &SwitchStmt::cond  );
     720                maybe_accept( node, &SwitchStmt::stmts );
     721        )
     722
     723        VISIT_END( Stmt, node );
     724}
     725
     726//--------------------------------------------------------------------------
     727// CaseStmt
     728template< typename pass_t >
     729const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CaseStmt * node ) {
     730        VISIT_START( node );
     731
     732        VISIT(
     733                maybe_accept( node, &CaseStmt::cond  );
     734                maybe_accept( node, &CaseStmt::stmts );
     735        )
     736
     737        VISIT_END( Stmt, node );
     738}
     739
     740//--------------------------------------------------------------------------
     741// BranchStmt
     742template< typename pass_t >
     743const ast::Stmt * ast::Pass< pass_t >::visit( const ast::BranchStmt * node ) {
     744        VISIT_START( node );
     745        VISIT_END( Stmt, node );
     746}
     747
     748//--------------------------------------------------------------------------
     749// ReturnStmt
     750template< typename pass_t >
     751const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ReturnStmt * node ) {
     752        VISIT_START( node );
     753
     754        VISIT(
     755                maybe_accept( node, &ReturnStmt::expr );
     756        )
     757
     758        VISIT_END( Stmt, node );
     759}
     760
     761//--------------------------------------------------------------------------
     762// ThrowStmt
     763template< typename pass_t >
     764const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ThrowStmt * node ) {
     765        VISIT_START( node );
     766
     767        VISIT(
     768                maybe_accept( node, &ThrowStmt::expr   );
     769                maybe_accept( node, &ThrowStmt::target );
     770        )
     771
     772        VISIT_END( Stmt, node );
     773}
     774
     775//--------------------------------------------------------------------------
     776// TryStmt
     777template< typename pass_t >
     778const ast::Stmt * ast::Pass< pass_t >::visit( const ast::TryStmt * node ) {
     779        VISIT_START( node );
     780
     781        VISIT(
     782                maybe_accept( node, &TryStmt::block        );
     783                maybe_accept( node, &TryStmt::handlers     );
     784                maybe_accept( node, &TryStmt::finallyBlock );
     785        )
    692786
    693787        VISIT_END( Stmt, node );
Note: See TracChangeset for help on using the changeset viewer.