Ignore:
Timestamp:
May 16, 2019, 4:13:19 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e61207e7
Parents:
1fb7bfd
Message:

Tentative fix for increment/decrement and implented a few more visits

File:
1 edited

Legend:

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

    r1fb7bfd r87701b6  
    462462        VISIT({
    463463                guard_indexer guard { * this };
    464                 maybe_accept( node, &StructDecl::parameters );
    465                 maybe_accept( node, &StructDecl::members    );
     464                maybe_accept( node, &StructDecl::params );
     465                maybe_accept( node, &StructDecl::members );
    466466        })
    467467
     
    483483        VISIT({
    484484                guard_indexer guard { * this };
    485                 maybe_accept( node, &UnionDecl::parameters );
    486                 maybe_accept( node, &UnionDecl::members    );
     485                maybe_accept( node, &UnionDecl::params );
     486                maybe_accept( node, &UnionDecl::members );
    487487        })
    488488
     
    502502        VISIT(
    503503                // unlike structs, traits, and unions, enums inject their members into the global scope
    504                 maybe_accept( node, &EnumDecl::parameters );
    505                 maybe_accept( node, &EnumDecl::members    );
     504                maybe_accept( node, &EnumDecl::params );
     505                maybe_accept( node, &EnumDecl::members );
    506506        )
    507507
     
    517517        VISIT({
    518518                guard_indexer guard { *this };
    519                 maybe_accept( node, &TraitDecl::parameters );
    520                 maybe_accept( node, &TraitDecl::members    );
     519                maybe_accept( node, &TraitDecl::params );
     520                maybe_accept( node, &TraitDecl::members );
    521521        })
    522522
     
    534534        VISIT({
    535535                guard_indexer guard { *this };
    536                 maybe_accept( node, &TypeDecl::parameters );
    537                 maybe_accept( node, &TypeDecl::base       );
     536                maybe_accept( node, &TypeDecl::params );
     537                maybe_accept( node, &TypeDecl::base   );
    538538        })
    539539
     
    563563        VISIT({
    564564                guard_indexer guard { *this };
    565                 maybe_accept( node, &TypedefDecl::parameters );
    566                 maybe_accept( node, &TypedefDecl::base       );
     565                maybe_accept( node, &TypedefDecl::params );
     566                maybe_accept( node, &TypedefDecl::base   );
    567567        })
    568568
     
    690690
    691691        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        maybe_accept( node, &ReturnStmt::expr );
     755
     756        VISIT_END( Stmt, node );
     757}
     758
     759//--------------------------------------------------------------------------
     760// ThrowStmt
     761
     762template< typename pass_type >
     763void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
     764        VISIT_START( node );
     765
     766        maybeAccept_impl( node->expr, *this );
     767        maybeAccept_impl( node->target, *this );
     768
     769        VISIT_END( node );
    692770}
    693771
Note: See TracChangeset for help on using the changeset viewer.