Ignore:
Timestamp:
Jun 8, 2023, 3:19:43 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Parents:
044ae62
Message:

Finish Adt POC

File:
1 edited

Legend:

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

    r044ae62 rfa2c005  
    585585
    586586//--------------------------------------------------------------------------
     587// AdtDecl
     588template< typename core_t >
     589const ast::Decl * ast::Pass< core_t >::visit( const ast::AdtDecl * node ) {
     590        VISIT_START( node );
     591
     592        __pass::symtab::addAdtFwd( core, 0, node );
     593
     594        if ( __visit_children() ) {
     595                guard_symtab guard { *this };
     596                maybe_accept( node, &AdtDecl::params );
     597                maybe_accept( node, &AdtDecl::members );
     598                maybe_accept( node, &AdtDecl::attributes );
     599
     600                maybe_accept( node, &AdtDecl::data_union );
     601                maybe_accept( node, &AdtDecl::tag );
     602                maybe_accept( node, &AdtDecl::tag_union );
     603        }
     604
     605        __pass::symtab::addAdt( core, 0, node );
     606        VISIT_END( Decl, node );
     607}
     608
     609//--------------------------------------------------------------------------
    587610// UnionDecl
    588611template< typename core_t >
     
    620643                        maybe_accept( node, &EnumDecl::members    );
    621644                        maybe_accept( node, &EnumDecl::attributes );
    622 
    623                         // maybe_accept( node, &EnumDecl::data_constructors );
    624                         // maybe_accept( node, &EnumDecl::data_union );
    625                         // maybe_accept( node, &EnumDecl::tag );
    626                         // maybe_accept( node, &EnumDecl::tag_union );
    627645                } else {
    628646                        maybe_accept( node, &EnumDecl::base );
     
    630648                        maybe_accept( node, &EnumDecl::members    );
    631649                        maybe_accept( node, &EnumDecl::attributes );
    632 
    633                         // maybe_accept( node, &EnumDecl::data_constructors );
    634                         // maybe_accept( node, &EnumDecl::data_union );
    635                         // maybe_accept( node, &EnumDecl::tag );
    636                         // maybe_accept( node, &EnumDecl::tag_union );
    637                 }
    638         }
    639 
    640         VISIT_END( Decl, node );
    641 }
    642 
    643 template< typename core_t >
    644 const ast::Decl * ast::Pass< core_t >::visit( const ast::AdtDecl * node ) {
    645         VISIT_START( node );
    646 
    647         __pass::symtab::addAdt( core, 0, node );
    648 
    649         if ( __visit_children() ) {
    650                 guard_symtab guard { *this };
    651                 maybe_accept( node, &AdtDecl::params );
    652                 maybe_accept( node, &AdtDecl::members );
    653                 maybe_accept( node, &AdtDecl::attributes );
    654 
    655                 maybe_accept( node, &AdtDecl::data_constructors );
    656                 maybe_accept( node, &AdtDecl::data_union );
    657                 maybe_accept( node, &AdtDecl::tag );
    658                 maybe_accept( node, &AdtDecl::tag_union );
     650                }
    659651        }
    660652
     
    19671959
    19681960//--------------------------------------------------------------------------
     1961// AdtInstType
     1962template< typename core_t >
     1963const ast::Type * ast::Pass< core_t >::visit( const ast::AdtInstType * node ) {
     1964        VISIT_START( node );
     1965
     1966        __pass::symtab::addAdt( core, 0, node->name );
     1967
     1968        if ( __visit_children() ) {
     1969                guard_symtab guard { *this };
     1970                maybe_accept( node, &AdtInstType::params );
     1971        }
     1972
     1973        VISIT_END( Type, node );
     1974}
     1975
     1976//--------------------------------------------------------------------------
    19691977// UnionInstType
    19701978template< typename core_t >
Note: See TracChangeset for help on using the changeset viewer.