Changes in / [7f66cec:f8d05ee]


Ignore:
Location:
src
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Copy.hpp

    r7f66cec rf8d05ee  
    121121        Pass< DeepCopyCore > dc;
    122122        node_t const * newRoot = localRoot->accept( dc );
    123         dc.pass.readonlyUpdates();
     123        dc.core.readonlyUpdates();
    124124        return const_cast< node_t * >( newRoot );
    125125}
  • src/AST/GenericSubstitution.cpp

    r7f66cec rf8d05ee  
    6262        Pass<GenericSubstitutionBuilder> builder;
    6363        maybe_accept( ty, builder );
    64         return std::move(builder.pass.sub);
     64        return std::move(builder.core.sub);
    6565}
    6666
  • src/AST/Pass.hpp

    r7f66cec rf8d05ee  
    6666// | WithForallSubstitutor - maintains links between TypeInstType and TypeDecl under mutation
    6767//-------------------------------------------------------------------------------------------------
    68 template< typename pass_t >
     68template< typename core_t >
    6969class Pass final : public ast::Visitor {
    7070public:
     71        using core_type = core_t;
     72        using type = Pass<core_t>;
     73
    7174        /// Forward any arguments to the pass constructor
    7275        /// Propagate 'this' if necessary
    7376        template< typename... Args >
    7477        Pass( Args &&... args)
    75                 : pass( std::forward<Args>( args )... )
     78                : core( std::forward<Args>( args )... )
    7679        {
    7780                // After the pass is constructed, check if it wants the have a pointer to the wrapping visitor
    78                 typedef Pass<pass_t> this_t;
    79                 this_t * const * visitor = __pass::visitor(pass, 0);
     81                type * const * visitor = __pass::visitor(core, 0);
    8082                if(visitor) {
    81                         *const_cast<this_t **>( visitor ) = this;
     83                        *const_cast<type **>( visitor ) = this;
    8284                }
    8385        }
     
    8890        template< typename... Args >
    8991        static void run( std::list< ptr<Decl> > & decls, Args &&... args ) {
    90                 Pass<pass_t> visitor( std::forward<Args>( args )... );
     92                Pass<core_t> visitor( std::forward<Args>( args )... );
    9193                accept_all( decls, visitor );
    9294        }
    9395
    9496        /// Storage for the actual pass
    95         pass_t pass;
     97        core_t core;
    9698
    9799        /// Visit function declarations
     
    189191        const ast::TypeSubstitution * visit( const ast::TypeSubstitution     * ) override final;
    190192
    191         template<typename pass_type>
    192         friend void accept_all( std::list< ptr<Decl> > & decls, Pass<pass_type>& visitor );
     193        template<typename core_type>
     194        friend void accept_all( std::list< ptr<Decl> > & decls, Pass<core_type>& visitor );
    193195private:
    194196
    195         bool __visit_children() { __pass::bool_ref * ptr = __pass::visit_children(pass, 0); return ptr ? *ptr : true; }
     197        bool __visit_children() { __pass::bool_ref * ptr = __pass::visit_children(core, 0); return ptr ? *ptr : true; }
    196198
    197199private:
     
    224226        /// Internal RAII guard for symbol table features
    225227        struct guard_symtab {
    226                 guard_symtab( Pass<pass_t> & pass ): pass( pass ) { __pass::symtab::enter(pass.pass, 0); }
    227                 ~guard_symtab()                                   { __pass::symtab::leave(pass.pass, 0); }
    228                 Pass<pass_t> & pass;
     228                guard_symtab( Pass<core_t> & pass ): pass( pass ) { __pass::symtab::enter(pass.core, 0); }
     229                ~guard_symtab()                                   { __pass::symtab::leave(pass.core, 0); }
     230                Pass<core_t> & pass;
    229231        };
    230232
    231233        /// Internal RAII guard for scope features
    232234        struct guard_scope {
    233                 guard_scope( Pass<pass_t> & pass ): pass( pass ) { __pass::scope::enter(pass.pass, 0); }
    234                 ~guard_scope()                                   { __pass::scope::leave(pass.pass, 0); }
    235                 Pass<pass_t> & pass;
     235                guard_scope( Pass<core_t> & pass ): pass( pass ) { __pass::scope::enter(pass.core, 0); }
     236                ~guard_scope()                                   { __pass::scope::leave(pass.core, 0); }
     237                Pass<core_t> & pass;
    236238        };
    237239
    238240        /// Internal RAII guard for forall substitutions
    239241        struct guard_forall_subs {
    240                 guard_forall_subs( Pass<pass_t> & pass, const ParameterizedType * type )
    241                 : pass( pass ), type( type ) { __pass::forall::enter(pass.pass, 0, type ); }
    242                 ~guard_forall_subs()         { __pass::forall::leave(pass.pass, 0, type ); }
    243                 Pass<pass_t> & pass;
     242                guard_forall_subs( Pass<core_t> & pass, const ParameterizedType * type )
     243                : pass( pass ), type( type ) { __pass::forall::enter(pass.core, 0, type ); }
     244                ~guard_forall_subs()         { __pass::forall::leave(pass.core, 0, type ); }
     245                Pass<core_t> & pass;
    244246                const ParameterizedType * type;
    245247        };
     
    250252
    251253/// Apply a pass to an entire translation unit
    252 template<typename pass_t>
    253 void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<pass_t> & visitor );
     254template<typename core_t>
     255void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<core_t> & visitor );
    254256
    255257//-------------------------------------------------------------------------------------------------
     
    291293        };
    292294
    293         template< typename pass_t>
    294         friend auto __pass::at_cleanup( pass_t & pass, int ) -> decltype( &pass.at_cleanup );
     295        template< typename core_t>
     296        friend auto __pass::at_cleanup( core_t & core, int ) -> decltype( &core.at_cleanup );
    295297public:
    296298
     
    328330
    329331/// Used to get a pointer to the pass with its wrapped type
    330 template<typename pass_t>
     332template<typename core_t>
    331333struct WithVisitorRef {
    332         Pass<pass_t> * const visitor = nullptr;
     334        Pass<core_t> * const visitor = nullptr;
    333335};
    334336
  • src/AST/Pass.impl.hpp

    r7f66cec rf8d05ee  
    2525        using namespace ast; \
    2626        /* back-up the visit children */ \
    27         __attribute__((unused)) ast::__pass::visit_children_guard guard1( ast::__pass::visit_children(pass, 0) ); \
     27        __attribute__((unused)) ast::__pass::visit_children_guard guard1( ast::__pass::visit_children(core, 0) ); \
    2828        /* setup the scope for passes that want to run code at exit */ \
    29         __attribute__((unused)) ast::__pass::guard_value          guard2( ast::__pass::at_cleanup    (pass, 0) ); \
     29        __attribute__((unused)) ast::__pass::guard_value          guard2( ast::__pass::at_cleanup    (core, 0) ); \
    3030        /* begin tracing memory allocation if requested by this pass */ \
    31         __pass::beginTrace( pass, 0 ); \
     31        __pass::beginTrace( core, 0 ); \
    3232        /* call the implementation of the previsit of this pass */ \
    33         __pass::previsit( pass, node, 0 );
     33        __pass::previsit( core, node, 0 );
    3434
    3535#define VISIT( code... ) \
     
    4242#define VISIT_END( type, node ) \
    4343        /* call the implementation of the postvisit of this pass */ \
    44         auto __return = __pass::postvisit( pass, node, 0 ); \
     44        auto __return = __pass::postvisit( core, node, 0 ); \
    4545        assertf(__return, "post visit should never return null"); \
    4646        /* end tracing memory allocation if requested by this pass */ \
    47         __pass::endTrace( pass, 0 ); \
     47        __pass::endTrace( core, 0 ); \
    4848        return __return;
    4949
     
    123123        }
    124124
    125         template< typename pass_t >
     125        template< typename core_t >
    126126        template< typename node_t >
    127         auto ast::Pass< pass_t >::call_accept( const node_t * node )
     127        auto ast::Pass< core_t >::call_accept( const node_t * node )
    128128                -> typename std::enable_if<
    129129                                !std::is_base_of<ast::Expr, node_t>::value &&
     
    141141        }
    142142
    143         template< typename pass_t >
    144         const ast::Expr * ast::Pass< pass_t >::call_accept( const ast::Expr * expr ) {
     143        template< typename core_t >
     144        const ast::Expr * ast::Pass< core_t >::call_accept( const ast::Expr * expr ) {
    145145                __pedantic_pass_assert( __visit_children() );
    146146                __pedantic_pass_assert( expr );
    147147
    148                 const ast::TypeSubstitution ** env_ptr = __pass::env( pass, 0);
     148                const ast::TypeSubstitution ** env_ptr = __pass::env( core, 0);
    149149                if ( env_ptr && expr->env ) {
    150150                        *env_ptr = expr->env;
     
    154154        }
    155155
    156         template< typename pass_t >
    157         const ast::Stmt * ast::Pass< pass_t >::call_accept( const ast::Stmt * stmt ) {
     156        template< typename core_t >
     157        const ast::Stmt * ast::Pass< core_t >::call_accept( const ast::Stmt * stmt ) {
    158158                __pedantic_pass_assert( __visit_children() );
    159159                __pedantic_pass_assert( stmt );
     
    163163
    164164                // get the stmts/decls that will need to be spliced in
    165                 auto stmts_before = __pass::stmtsToAddBefore( pass, 0);
    166                 auto stmts_after  = __pass::stmtsToAddAfter ( pass, 0);
    167                 auto decls_before = __pass::declsToAddBefore( pass, 0);
    168                 auto decls_after  = __pass::declsToAddAfter ( pass, 0);
     165                auto stmts_before = __pass::stmtsToAddBefore( core, 0);
     166                auto stmts_after  = __pass::stmtsToAddAfter ( core, 0);
     167                auto decls_before = __pass::declsToAddBefore( core, 0);
     168                auto decls_after  = __pass::declsToAddAfter ( core, 0);
    169169
    170170                // These may be modified by subnode but most be restored once we exit this statemnet.
    171                 ValueGuardPtr< const ast::TypeSubstitution * > __old_env         ( __pass::env( pass, 0) );
     171                ValueGuardPtr< const ast::TypeSubstitution * > __old_env         ( __pass::env( core, 0) );
    172172                ValueGuardPtr< typename std::remove_pointer< decltype(stmts_before) >::type > __old_decls_before( stmts_before );
    173173                ValueGuardPtr< typename std::remove_pointer< decltype(stmts_after ) >::type > __old_decls_after ( stmts_after  );
     
    205205        }
    206206
    207         template< typename pass_t >
     207        template< typename core_t >
    208208        template< template <class...> class container_t >
    209         container_t< ptr<Stmt> > ast::Pass< pass_t >::call_accept( const container_t< ptr<Stmt> > & statements ) {
     209        container_t< ptr<Stmt> > ast::Pass< core_t >::call_accept( const container_t< ptr<Stmt> > & statements ) {
    210210                __pedantic_pass_assert( __visit_children() );
    211211                if( statements.empty() ) return {};
     
    218218
    219219                // get the stmts/decls that will need to be spliced in
    220                 auto stmts_before = __pass::stmtsToAddBefore( pass, 0);
    221                 auto stmts_after  = __pass::stmtsToAddAfter ( pass, 0);
    222                 auto decls_before = __pass::declsToAddBefore( pass, 0);
    223                 auto decls_after  = __pass::declsToAddAfter ( pass, 0);
     220                auto stmts_before = __pass::stmtsToAddBefore( core, 0);
     221                auto stmts_after  = __pass::stmtsToAddAfter ( core, 0);
     222                auto decls_before = __pass::declsToAddBefore( core, 0);
     223                auto decls_after  = __pass::declsToAddAfter ( core, 0);
    224224
    225225                // These may be modified by subnode but most be restored once we exit this statemnet.
     
    271271        }
    272272
    273         template< typename pass_t >
     273        template< typename core_t >
    274274        template< template <class...> class container_t, typename node_t >
    275         container_t< ast::ptr<node_t> > ast::Pass< pass_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) {
     275        container_t< ast::ptr<node_t> > ast::Pass< core_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) {
    276276                __pedantic_pass_assert( __visit_children() );
    277277                if( container.empty() ) return {};
     
    302302        }
    303303
    304         template< typename pass_t >
     304        template< typename core_t >
    305305        template<typename node_t, typename parent_t, typename child_t>
    306         void ast::Pass< pass_t >::maybe_accept(
     306        void ast::Pass< core_t >::maybe_accept(
    307307                const node_t * & parent,
    308308                child_t parent_t::*child
     
    327327
    328328
    329         template< typename pass_t >
     329        template< typename core_t >
    330330        template< typename node_t >
    331         void ast::Pass< pass_t >::mutate_forall( const node_t *& node ) {
    332                 if ( auto subs = __pass::forall::subs( pass, 0 ) ) {
     331        void ast::Pass< core_t >::mutate_forall( const node_t *& node ) {
     332                if ( auto subs = __pass::forall::subs( core, 0 ) ) {
    333333                        // tracking TypeDecl substitution, full clone
    334334                        if ( node->forall.empty() ) return;
     
    352352//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    353353
    354 template< typename pass_t >
    355 inline void ast::accept_all( std::list< ast::ptr<ast::Decl> > & decls, ast::Pass< pass_t > & visitor ) {
     354template< typename core_t >
     355inline void ast::accept_all( std::list< ast::ptr<ast::Decl> > & decls, ast::Pass< core_t > & visitor ) {
    356356        // We are going to aggregate errors for all these statements
    357357        SemanticErrorException errors;
     
    361361
    362362        // get the stmts/decls that will need to be spliced in
    363         auto decls_before = __pass::declsToAddBefore( visitor.pass, 0);
    364         auto decls_after  = __pass::declsToAddAfter ( visitor.pass, 0);
     363        auto decls_before = __pass::declsToAddBefore( visitor.core, 0);
     364        auto decls_after  = __pass::declsToAddAfter ( visitor.core, 0);
    365365
    366366        // update pass statitistics
     
    411411//--------------------------------------------------------------------------
    412412// ObjectDecl
    413 template< typename pass_t >
    414 const ast::DeclWithType * ast::Pass< pass_t >::visit( const ast::ObjectDecl * node ) {
     413template< typename core_t >
     414const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::ObjectDecl * node ) {
    415415        VISIT_START( node );
    416416
     
    425425        )
    426426
    427         __pass::symtab::addId( pass, 0, node );
     427        __pass::symtab::addId( core, 0, node );
    428428
    429429        VISIT_END( DeclWithType, node );
     
    432432//--------------------------------------------------------------------------
    433433// FunctionDecl
    434 template< typename pass_t >
    435 const ast::DeclWithType * ast::Pass< pass_t >::visit( const ast::FunctionDecl * node ) {
    436         VISIT_START( node );
    437 
    438         __pass::symtab::addId( pass, 0, node );
     434template< typename core_t >
     435const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::FunctionDecl * node ) {
     436        VISIT_START( node );
     437
     438        __pass::symtab::addId( core, 0, node );
    439439
    440440        VISIT(maybe_accept( node, &FunctionDecl::withExprs );)
     
    444444                // shadow with exprs and not the other way around.
    445445                guard_symtab guard { *this };
    446                 __pass::symtab::addWith( pass, 0, node->withExprs, node );
     446                __pass::symtab::addWith( core, 0, node->withExprs, node );
    447447                {
    448448                        guard_symtab guard { *this };
     
    455455                                }
    456456                        } };
    457                         __pass::symtab::addId( pass, 0, func );
     457                        __pass::symtab::addId( core, 0, func );
    458458                        VISIT(
    459459                                maybe_accept( node, &FunctionDecl::type );
     
    473473//--------------------------------------------------------------------------
    474474// StructDecl
    475 template< typename pass_t >
    476 const ast::Decl * ast::Pass< pass_t >::visit( const ast::StructDecl * node ) {
     475template< typename core_t >
     476const ast::Decl * ast::Pass< core_t >::visit( const ast::StructDecl * node ) {
    477477        VISIT_START( node );
    478478
    479479        // make up a forward declaration and add it before processing the members
    480480        // needs to be on the heap because addStruct saves the pointer
    481         __pass::symtab::addStructFwd( pass, 0, node );
     481        __pass::symtab::addStructFwd( core, 0, node );
    482482
    483483        VISIT({
     
    488488
    489489        // this addition replaces the forward declaration
    490         __pass::symtab::addStruct( pass, 0, node );
     490        __pass::symtab::addStruct( core, 0, node );
    491491
    492492        VISIT_END( Decl, node );
     
    495495//--------------------------------------------------------------------------
    496496// UnionDecl
    497 template< typename pass_t >
    498 const ast::Decl * ast::Pass< pass_t >::visit( const ast::UnionDecl * node ) {
     497template< typename core_t >
     498const ast::Decl * ast::Pass< core_t >::visit( const ast::UnionDecl * node ) {
    499499        VISIT_START( node );
    500500
    501501        // make up a forward declaration and add it before processing the members
    502         __pass::symtab::addUnionFwd( pass, 0, node );
     502        __pass::symtab::addUnionFwd( core, 0, node );
    503503
    504504        VISIT({
     
    508508        })
    509509
    510         __pass::symtab::addUnion( pass, 0, node );
     510        __pass::symtab::addUnion( core, 0, node );
    511511
    512512        VISIT_END( Decl, node );
     
    515515//--------------------------------------------------------------------------
    516516// EnumDecl
    517 template< typename pass_t >
    518 const ast::Decl * ast::Pass< pass_t >::visit( const ast::EnumDecl * node ) {
    519         VISIT_START( node );
    520 
    521         __pass::symtab::addEnum( pass, 0, node );
     517template< typename core_t >
     518const ast::Decl * ast::Pass< core_t >::visit( const ast::EnumDecl * node ) {
     519        VISIT_START( node );
     520
     521        __pass::symtab::addEnum( core, 0, node );
    522522
    523523        VISIT(
     
    532532//--------------------------------------------------------------------------
    533533// TraitDecl
    534 template< typename pass_t >
    535 const ast::Decl * ast::Pass< pass_t >::visit( const ast::TraitDecl * node ) {
     534template< typename core_t >
     535const ast::Decl * ast::Pass< core_t >::visit( const ast::TraitDecl * node ) {
    536536        VISIT_START( node );
    537537
     
    542542        })
    543543
    544         __pass::symtab::addTrait( pass, 0, node );
     544        __pass::symtab::addTrait( core, 0, node );
    545545
    546546        VISIT_END( Decl, node );
     
    549549//--------------------------------------------------------------------------
    550550// TypeDecl
    551 template< typename pass_t >
    552 const ast::Decl * ast::Pass< pass_t >::visit( const ast::TypeDecl * node ) {
     551template< typename core_t >
     552const ast::Decl * ast::Pass< core_t >::visit( const ast::TypeDecl * node ) {
    553553        VISIT_START( node );
    554554
     
    562562        // note that assertions come after the type is added to the symtab, since they are not part of the type proper
    563563        // and may depend on the type itself
    564         __pass::symtab::addType( pass, 0, node );
     564        __pass::symtab::addType( core, 0, node );
    565565
    566566        VISIT(
     
    578578//--------------------------------------------------------------------------
    579579// TypedefDecl
    580 template< typename pass_t >
    581 const ast::Decl * ast::Pass< pass_t >::visit( const ast::TypedefDecl * node ) {
     580template< typename core_t >
     581const ast::Decl * ast::Pass< core_t >::visit( const ast::TypedefDecl * node ) {
    582582        VISIT_START( node );
    583583
     
    588588        })
    589589
    590         __pass::symtab::addType( pass, 0, node );
     590        __pass::symtab::addType( core, 0, node );
    591591
    592592        VISIT( maybe_accept( node, &TypedefDecl::assertions ); )
     
    597597//--------------------------------------------------------------------------
    598598// AsmDecl
    599 template< typename pass_t >
    600 const ast::AsmDecl * ast::Pass< pass_t >::visit( const ast::AsmDecl * node ) {
     599template< typename core_t >
     600const ast::AsmDecl * ast::Pass< core_t >::visit( const ast::AsmDecl * node ) {
    601601        VISIT_START( node );
    602602
     
    610610//--------------------------------------------------------------------------
    611611// StaticAssertDecl
    612 template< typename pass_t >
    613 const ast::StaticAssertDecl * ast::Pass< pass_t >::visit( const ast::StaticAssertDecl * node ) {
     612template< typename core_t >
     613const ast::StaticAssertDecl * ast::Pass< core_t >::visit( const ast::StaticAssertDecl * node ) {
    614614        VISIT_START( node );
    615615
     
    624624//--------------------------------------------------------------------------
    625625// CompoundStmt
    626 template< typename pass_t >
    627 const ast::CompoundStmt * ast::Pass< pass_t >::visit( const ast::CompoundStmt * node ) {
     626template< typename core_t >
     627const ast::CompoundStmt * ast::Pass< core_t >::visit( const ast::CompoundStmt * node ) {
    628628        VISIT_START( node );
    629629        VISIT({
    630630                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
    631631                auto guard1 = makeFuncGuard( [this, inFunctionCpy = this->inFunction]() {
    632                         if ( ! inFunctionCpy ) __pass::symtab::enter(pass, 0);
     632                        if ( ! inFunctionCpy ) __pass::symtab::enter(core, 0);
    633633                }, [this, inFunctionCpy = this->inFunction]() {
    634                         if ( ! inFunctionCpy ) __pass::symtab::leave(pass, 0);
     634                        if ( ! inFunctionCpy ) __pass::symtab::leave(core, 0);
    635635                });
    636636                ValueGuard< bool > guard2( inFunction );
     
    644644//--------------------------------------------------------------------------
    645645// ExprStmt
    646 template< typename pass_t >
    647 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ExprStmt * node ) {
     646template< typename core_t >
     647const ast::Stmt * ast::Pass< core_t >::visit( const ast::ExprStmt * node ) {
    648648        VISIT_START( node );
    649649
     
    657657//--------------------------------------------------------------------------
    658658// AsmStmt
    659 template< typename pass_t >
    660 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::AsmStmt * node ) {
     659template< typename core_t >
     660const ast::Stmt * ast::Pass< core_t >::visit( const ast::AsmStmt * node ) {
    661661        VISIT_START( node )
    662662
     
    673673//--------------------------------------------------------------------------
    674674// DirectiveStmt
    675 template< typename pass_t >
    676 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DirectiveStmt * node ) {
     675template< typename core_t >
     676const ast::Stmt * ast::Pass< core_t >::visit( const ast::DirectiveStmt * node ) {
    677677        VISIT_START( node )
    678678
     
    682682//--------------------------------------------------------------------------
    683683// IfStmt
    684 template< typename pass_t >
    685 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::IfStmt * node ) {
     684template< typename core_t >
     685const ast::Stmt * ast::Pass< core_t >::visit( const ast::IfStmt * node ) {
    686686        VISIT_START( node );
    687687
     
    700700//--------------------------------------------------------------------------
    701701// WhileStmt
    702 template< typename pass_t >
    703 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WhileStmt * node ) {
     702template< typename core_t >
     703const ast::Stmt * ast::Pass< core_t >::visit( const ast::WhileStmt * node ) {
    704704        VISIT_START( node );
    705705
     
    717717//--------------------------------------------------------------------------
    718718// ForStmt
    719 template< typename pass_t >
    720 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ForStmt * node ) {
     719template< typename core_t >
     720const ast::Stmt * ast::Pass< core_t >::visit( const ast::ForStmt * node ) {
    721721        VISIT_START( node );
    722722
     
    735735//--------------------------------------------------------------------------
    736736// SwitchStmt
    737 template< typename pass_t >
    738 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::SwitchStmt * node ) {
     737template< typename core_t >
     738const ast::Stmt * ast::Pass< core_t >::visit( const ast::SwitchStmt * node ) {
    739739        VISIT_START( node );
    740740
     
    749749//--------------------------------------------------------------------------
    750750// CaseStmt
    751 template< typename pass_t >
    752 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CaseStmt * node ) {
     751template< typename core_t >
     752const ast::Stmt * ast::Pass< core_t >::visit( const ast::CaseStmt * node ) {
    753753        VISIT_START( node );
    754754
     
    763763//--------------------------------------------------------------------------
    764764// BranchStmt
    765 template< typename pass_t >
    766 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::BranchStmt * node ) {
     765template< typename core_t >
     766const ast::Stmt * ast::Pass< core_t >::visit( const ast::BranchStmt * node ) {
    767767        VISIT_START( node );
    768768        VISIT_END( Stmt, node );
     
    771771//--------------------------------------------------------------------------
    772772// ReturnStmt
    773 template< typename pass_t >
    774 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ReturnStmt * node ) {
     773template< typename core_t >
     774const ast::Stmt * ast::Pass< core_t >::visit( const ast::ReturnStmt * node ) {
    775775        VISIT_START( node );
    776776
     
    784784//--------------------------------------------------------------------------
    785785// ThrowStmt
    786 template< typename pass_t >
    787 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ThrowStmt * node ) {
     786template< typename core_t >
     787const ast::Stmt * ast::Pass< core_t >::visit( const ast::ThrowStmt * node ) {
    788788        VISIT_START( node );
    789789
     
    798798//--------------------------------------------------------------------------
    799799// TryStmt
    800 template< typename pass_t >
    801 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::TryStmt * node ) {
     800template< typename core_t >
     801const ast::Stmt * ast::Pass< core_t >::visit( const ast::TryStmt * node ) {
    802802        VISIT_START( node );
    803803
     
    813813//--------------------------------------------------------------------------
    814814// CatchStmt
    815 template< typename pass_t >
    816 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CatchStmt * node ) {
     815template< typename core_t >
     816const ast::Stmt * ast::Pass< core_t >::visit( const ast::CatchStmt * node ) {
    817817        VISIT_START( node );
    818818
     
    830830//--------------------------------------------------------------------------
    831831// FinallyStmt
    832 template< typename pass_t >
    833 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::FinallyStmt * node ) {
     832template< typename core_t >
     833const ast::Stmt * ast::Pass< core_t >::visit( const ast::FinallyStmt * node ) {
    834834        VISIT_START( node );
    835835
     
    843843//--------------------------------------------------------------------------
    844844// FinallyStmt
    845 template< typename pass_t >
    846 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::SuspendStmt * node ) {
     845template< typename core_t >
     846const ast::Stmt * ast::Pass< core_t >::visit( const ast::SuspendStmt * node ) {
    847847        VISIT_START( node );
    848848
     
    856856//--------------------------------------------------------------------------
    857857// WaitForStmt
    858 template< typename pass_t >
    859 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WaitForStmt * node ) {
     858template< typename core_t >
     859const ast::Stmt * ast::Pass< core_t >::visit( const ast::WaitForStmt * node ) {
    860860        VISIT_START( node );
    861861                // for( auto & clause : node->clauses ) {
     
    925925//--------------------------------------------------------------------------
    926926// WithStmt
    927 template< typename pass_t >
    928 const ast::Decl * ast::Pass< pass_t >::visit( const ast::WithStmt * node ) {
     927template< typename core_t >
     928const ast::Decl * ast::Pass< core_t >::visit( const ast::WithStmt * node ) {
    929929        VISIT_START( node );
    930930
     
    934934                        // catch statements introduce a level of scope (for the caught exception)
    935935                        guard_symtab guard { *this };
    936                         __pass::symtab::addWith( pass, 0, node->exprs, node );
     936                        __pass::symtab::addWith( core, 0, node->exprs, node );
    937937                        maybe_accept( node, &WithStmt::stmt );
    938938                }
     
    943943//--------------------------------------------------------------------------
    944944// NullStmt
    945 template< typename pass_t >
    946 const ast::NullStmt * ast::Pass< pass_t >::visit( const ast::NullStmt * node ) {
     945template< typename core_t >
     946const ast::NullStmt * ast::Pass< core_t >::visit( const ast::NullStmt * node ) {
    947947        VISIT_START( node );
    948948        VISIT_END( NullStmt, node );
     
    951951//--------------------------------------------------------------------------
    952952// DeclStmt
    953 template< typename pass_t >
    954 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DeclStmt * node ) {
     953template< typename core_t >
     954const ast::Stmt * ast::Pass< core_t >::visit( const ast::DeclStmt * node ) {
    955955        VISIT_START( node );
    956956
     
    964964//--------------------------------------------------------------------------
    965965// ImplicitCtorDtorStmt
    966 template< typename pass_t >
    967 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ImplicitCtorDtorStmt * node ) {
     966template< typename core_t >
     967const ast::Stmt * ast::Pass< core_t >::visit( const ast::ImplicitCtorDtorStmt * node ) {
    968968        VISIT_START( node );
    969969
     
    979979//--------------------------------------------------------------------------
    980980// ApplicationExpr
    981 template< typename pass_t >
    982 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ApplicationExpr * node ) {
     981template< typename core_t >
     982const ast::Expr * ast::Pass< core_t >::visit( const ast::ApplicationExpr * node ) {
    983983        VISIT_START( node );
    984984
     
    997997//--------------------------------------------------------------------------
    998998// UntypedExpr
    999 template< typename pass_t >
    1000 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedExpr * node ) {
     999template< typename core_t >
     1000const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedExpr * node ) {
    10011001        VISIT_START( node );
    10021002
     
    10151015//--------------------------------------------------------------------------
    10161016// NameExpr
    1017 template< typename pass_t >
    1018 const ast::Expr * ast::Pass< pass_t >::visit( const ast::NameExpr * node ) {
     1017template< typename core_t >
     1018const ast::Expr * ast::Pass< core_t >::visit( const ast::NameExpr * node ) {
    10191019        VISIT_START( node );
    10201020
     
    10291029//--------------------------------------------------------------------------
    10301030// CastExpr
    1031 template< typename pass_t >
    1032 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CastExpr * node ) {
     1031template< typename core_t >
     1032const ast::Expr * ast::Pass< core_t >::visit( const ast::CastExpr * node ) {
    10331033        VISIT_START( node );
    10341034
     
    10451045//--------------------------------------------------------------------------
    10461046// KeywordCastExpr
    1047 template< typename pass_t >
    1048 const ast::Expr * ast::Pass< pass_t >::visit( const ast::KeywordCastExpr * node ) {
     1047template< typename core_t >
     1048const ast::Expr * ast::Pass< core_t >::visit( const ast::KeywordCastExpr * node ) {
    10491049        VISIT_START( node );
    10501050
     
    10611061//--------------------------------------------------------------------------
    10621062// VirtualCastExpr
    1063 template< typename pass_t >
    1064 const ast::Expr * ast::Pass< pass_t >::visit( const ast::VirtualCastExpr * node ) {
     1063template< typename core_t >
     1064const ast::Expr * ast::Pass< core_t >::visit( const ast::VirtualCastExpr * node ) {
    10651065        VISIT_START( node );
    10661066
     
    10771077//--------------------------------------------------------------------------
    10781078// AddressExpr
    1079 template< typename pass_t >
    1080 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AddressExpr * node ) {
     1079template< typename core_t >
     1080const ast::Expr * ast::Pass< core_t >::visit( const ast::AddressExpr * node ) {
    10811081        VISIT_START( node );
    10821082
     
    10931093//--------------------------------------------------------------------------
    10941094// LabelAddressExpr
    1095 template< typename pass_t >
    1096 const ast::Expr * ast::Pass< pass_t >::visit( const ast::LabelAddressExpr * node ) {
     1095template< typename core_t >
     1096const ast::Expr * ast::Pass< core_t >::visit( const ast::LabelAddressExpr * node ) {
    10971097        VISIT_START( node );
    10981098
     
    11071107//--------------------------------------------------------------------------
    11081108// UntypedMemberExpr
    1109 template< typename pass_t >
    1110 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedMemberExpr * node ) {
     1109template< typename core_t >
     1110const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedMemberExpr * node ) {
    11111111        VISIT_START( node );
    11121112
     
    11241124//--------------------------------------------------------------------------
    11251125// MemberExpr
    1126 template< typename pass_t >
    1127 const ast::Expr * ast::Pass< pass_t >::visit( const ast::MemberExpr * node ) {
     1126template< typename core_t >
     1127const ast::Expr * ast::Pass< core_t >::visit( const ast::MemberExpr * node ) {
    11281128        VISIT_START( node );
    11291129
     
    11401140//--------------------------------------------------------------------------
    11411141// VariableExpr
    1142 template< typename pass_t >
    1143 const ast::Expr * ast::Pass< pass_t >::visit( const ast::VariableExpr * node ) {
     1142template< typename core_t >
     1143const ast::Expr * ast::Pass< core_t >::visit( const ast::VariableExpr * node ) {
    11441144        VISIT_START( node );
    11451145
     
    11541154//--------------------------------------------------------------------------
    11551155// ConstantExpr
    1156 template< typename pass_t >
    1157 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConstantExpr * node ) {
     1156template< typename core_t >
     1157const ast::Expr * ast::Pass< core_t >::visit( const ast::ConstantExpr * node ) {
    11581158        VISIT_START( node );
    11591159
     
    11681168//--------------------------------------------------------------------------
    11691169// SizeofExpr
    1170 template< typename pass_t >
    1171 const ast::Expr * ast::Pass< pass_t >::visit( const ast::SizeofExpr * node ) {
     1170template< typename core_t >
     1171const ast::Expr * ast::Pass< core_t >::visit( const ast::SizeofExpr * node ) {
    11721172        VISIT_START( node );
    11731173
     
    11881188//--------------------------------------------------------------------------
    11891189// AlignofExpr
    1190 template< typename pass_t >
    1191 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AlignofExpr * node ) {
     1190template< typename core_t >
     1191const ast::Expr * ast::Pass< core_t >::visit( const ast::AlignofExpr * node ) {
    11921192        VISIT_START( node );
    11931193
     
    12081208//--------------------------------------------------------------------------
    12091209// UntypedOffsetofExpr
    1210 template< typename pass_t >
    1211 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedOffsetofExpr * node ) {
     1210template< typename core_t >
     1211const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedOffsetofExpr * node ) {
    12121212        VISIT_START( node );
    12131213
     
    12241224//--------------------------------------------------------------------------
    12251225// OffsetofExpr
    1226 template< typename pass_t >
    1227 const ast::Expr * ast::Pass< pass_t >::visit( const ast::OffsetofExpr * node ) {
     1226template< typename core_t >
     1227const ast::Expr * ast::Pass< core_t >::visit( const ast::OffsetofExpr * node ) {
    12281228        VISIT_START( node );
    12291229
     
    12401240//--------------------------------------------------------------------------
    12411241// OffsetPackExpr
    1242 template< typename pass_t >
    1243 const ast::Expr * ast::Pass< pass_t >::visit( const ast::OffsetPackExpr * node ) {
     1242template< typename core_t >
     1243const ast::Expr * ast::Pass< core_t >::visit( const ast::OffsetPackExpr * node ) {
    12441244        VISIT_START( node );
    12451245
     
    12561256//--------------------------------------------------------------------------
    12571257// LogicalExpr
    1258 template< typename pass_t >
    1259 const ast::Expr * ast::Pass< pass_t >::visit( const ast::LogicalExpr * node ) {
     1258template< typename core_t >
     1259const ast::Expr * ast::Pass< core_t >::visit( const ast::LogicalExpr * node ) {
    12601260        VISIT_START( node );
    12611261
     
    12731273//--------------------------------------------------------------------------
    12741274// ConditionalExpr
    1275 template< typename pass_t >
    1276 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConditionalExpr * node ) {
     1275template< typename core_t >
     1276const ast::Expr * ast::Pass< core_t >::visit( const ast::ConditionalExpr * node ) {
    12771277        VISIT_START( node );
    12781278
     
    12911291//--------------------------------------------------------------------------
    12921292// CommaExpr
    1293 template< typename pass_t >
    1294 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CommaExpr * node ) {
     1293template< typename core_t >
     1294const ast::Expr * ast::Pass< core_t >::visit( const ast::CommaExpr * node ) {
    12951295        VISIT_START( node );
    12961296
     
    13081308//--------------------------------------------------------------------------
    13091309// TypeExpr
    1310 template< typename pass_t >
    1311 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TypeExpr * node ) {
     1310template< typename core_t >
     1311const ast::Expr * ast::Pass< core_t >::visit( const ast::TypeExpr * node ) {
    13121312        VISIT_START( node );
    13131313
     
    13241324//--------------------------------------------------------------------------
    13251325// AsmExpr
    1326 template< typename pass_t >
    1327 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AsmExpr * node ) {
     1326template< typename core_t >
     1327const ast::Expr * ast::Pass< core_t >::visit( const ast::AsmExpr * node ) {
    13281328        VISIT_START( node );
    13291329
     
    13411341//--------------------------------------------------------------------------
    13421342// ImplicitCopyCtorExpr
    1343 template< typename pass_t >
    1344 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ImplicitCopyCtorExpr * node ) {
     1343template< typename core_t >
     1344const ast::Expr * ast::Pass< core_t >::visit( const ast::ImplicitCopyCtorExpr * node ) {
    13451345        VISIT_START( node );
    13461346
     
    13571357//--------------------------------------------------------------------------
    13581358// ConstructorExpr
    1359 template< typename pass_t >
    1360 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConstructorExpr * node ) {
     1359template< typename core_t >
     1360const ast::Expr * ast::Pass< core_t >::visit( const ast::ConstructorExpr * node ) {
    13611361        VISIT_START( node );
    13621362
     
    13731373//--------------------------------------------------------------------------
    13741374// CompoundLiteralExpr
    1375 template< typename pass_t >
    1376 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CompoundLiteralExpr * node ) {
     1375template< typename core_t >
     1376const ast::Expr * ast::Pass< core_t >::visit( const ast::CompoundLiteralExpr * node ) {
    13771377        VISIT_START( node );
    13781378
     
    13891389//--------------------------------------------------------------------------
    13901390// RangeExpr
    1391 template< typename pass_t >
    1392 const ast::Expr * ast::Pass< pass_t >::visit( const ast::RangeExpr * node ) {
     1391template< typename core_t >
     1392const ast::Expr * ast::Pass< core_t >::visit( const ast::RangeExpr * node ) {
    13931393        VISIT_START( node );
    13941394
     
    14061406//--------------------------------------------------------------------------
    14071407// UntypedTupleExpr
    1408 template< typename pass_t >
    1409 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedTupleExpr * node ) {
     1408template< typename core_t >
     1409const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedTupleExpr * node ) {
    14101410        VISIT_START( node );
    14111411
     
    14221422//--------------------------------------------------------------------------
    14231423// TupleExpr
    1424 template< typename pass_t >
    1425 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleExpr * node ) {
     1424template< typename core_t >
     1425const ast::Expr * ast::Pass< core_t >::visit( const ast::TupleExpr * node ) {
    14261426        VISIT_START( node );
    14271427
     
    14381438//--------------------------------------------------------------------------
    14391439// TupleIndexExpr
    1440 template< typename pass_t >
    1441 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleIndexExpr * node ) {
     1440template< typename core_t >
     1441const ast::Expr * ast::Pass< core_t >::visit( const ast::TupleIndexExpr * node ) {
    14421442        VISIT_START( node );
    14431443
     
    14541454//--------------------------------------------------------------------------
    14551455// TupleAssignExpr
    1456 template< typename pass_t >
    1457 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleAssignExpr * node ) {
     1456template< typename core_t >
     1457const ast::Expr * ast::Pass< core_t >::visit( const ast::TupleAssignExpr * node ) {
    14581458        VISIT_START( node );
    14591459
     
    14701470//--------------------------------------------------------------------------
    14711471// StmtExpr
    1472 template< typename pass_t >
    1473 const ast::Expr * ast::Pass< pass_t >::visit( const ast::StmtExpr * node ) {
     1472template< typename core_t >
     1473const ast::Expr * ast::Pass< core_t >::visit( const ast::StmtExpr * node ) {
    14741474        VISIT_START( node );
    14751475
    14761476        VISIT(// don't want statements from outer CompoundStmts to be added to this StmtExpr
    14771477                // get the stmts that will need to be spliced in
    1478                 auto stmts_before = __pass::stmtsToAddBefore( pass, 0);
    1479                 auto stmts_after  = __pass::stmtsToAddAfter ( pass, 0);
     1478                auto stmts_before = __pass::stmtsToAddBefore( core, 0);
     1479                auto stmts_after  = __pass::stmtsToAddAfter ( core, 0);
    14801480
    14811481                // These may be modified by subnode but most be restored once we exit this statemnet.
    1482                 ValueGuardPtr< const ast::TypeSubstitution * > __old_env( __pass::env( pass, 0) );
     1482                ValueGuardPtr< const ast::TypeSubstitution * > __old_env( __pass::env( core, 0) );
    14831483                ValueGuardPtr< typename std::remove_pointer< decltype(stmts_before) >::type > __old_decls_before( stmts_before );
    14841484                ValueGuardPtr< typename std::remove_pointer< decltype(stmts_after ) >::type > __old_decls_after ( stmts_after  );
     
    14981498//--------------------------------------------------------------------------
    14991499// UniqueExpr
    1500 template< typename pass_t >
    1501 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UniqueExpr * node ) {
     1500template< typename core_t >
     1501const ast::Expr * ast::Pass< core_t >::visit( const ast::UniqueExpr * node ) {
    15021502        VISIT_START( node );
    15031503
     
    15141514//--------------------------------------------------------------------------
    15151515// UntypedInitExpr
    1516 template< typename pass_t >
    1517 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedInitExpr * node ) {
     1516template< typename core_t >
     1517const ast::Expr * ast::Pass< core_t >::visit( const ast::UntypedInitExpr * node ) {
    15181518        VISIT_START( node );
    15191519
     
    15311531//--------------------------------------------------------------------------
    15321532// InitExpr
    1533 template< typename pass_t >
    1534 const ast::Expr * ast::Pass< pass_t >::visit( const ast::InitExpr * node ) {
     1533template< typename core_t >
     1534const ast::Expr * ast::Pass< core_t >::visit( const ast::InitExpr * node ) {
    15351535        VISIT_START( node );
    15361536
     
    15481548//--------------------------------------------------------------------------
    15491549// DeletedExpr
    1550 template< typename pass_t >
    1551 const ast::Expr * ast::Pass< pass_t >::visit( const ast::DeletedExpr * node ) {
     1550template< typename core_t >
     1551const ast::Expr * ast::Pass< core_t >::visit( const ast::DeletedExpr * node ) {
    15521552        VISIT_START( node );
    15531553
     
    15651565//--------------------------------------------------------------------------
    15661566// DefaultArgExpr
    1567 template< typename pass_t >
    1568 const ast::Expr * ast::Pass< pass_t >::visit( const ast::DefaultArgExpr * node ) {
     1567template< typename core_t >
     1568const ast::Expr * ast::Pass< core_t >::visit( const ast::DefaultArgExpr * node ) {
    15691569        VISIT_START( node );
    15701570
     
    15811581//--------------------------------------------------------------------------
    15821582// GenericExpr
    1583 template< typename pass_t >
    1584 const ast::Expr * ast::Pass< pass_t >::visit( const ast::GenericExpr * node ) {
     1583template< typename core_t >
     1584const ast::Expr * ast::Pass< core_t >::visit( const ast::GenericExpr * node ) {
    15851585        VISIT_START( node );
    15861586
     
    16211621//--------------------------------------------------------------------------
    16221622// VoidType
    1623 template< typename pass_t >
    1624 const ast::Type * ast::Pass< pass_t >::visit( const ast::VoidType * node ) {
     1623template< typename core_t >
     1624const ast::Type * ast::Pass< core_t >::visit( const ast::VoidType * node ) {
    16251625        VISIT_START( node );
    16261626
     
    16301630//--------------------------------------------------------------------------
    16311631// BasicType
    1632 template< typename pass_t >
    1633 const ast::Type * ast::Pass< pass_t >::visit( const ast::BasicType * node ) {
     1632template< typename core_t >
     1633const ast::Type * ast::Pass< core_t >::visit( const ast::BasicType * node ) {
    16341634        VISIT_START( node );
    16351635
     
    16391639//--------------------------------------------------------------------------
    16401640// PointerType
    1641 template< typename pass_t >
    1642 const ast::Type * ast::Pass< pass_t >::visit( const ast::PointerType * node ) {
     1641template< typename core_t >
     1642const ast::Type * ast::Pass< core_t >::visit( const ast::PointerType * node ) {
    16431643        VISIT_START( node );
    16441644
     
    16531653//--------------------------------------------------------------------------
    16541654// ArrayType
    1655 template< typename pass_t >
    1656 const ast::Type * ast::Pass< pass_t >::visit( const ast::ArrayType * node ) {
     1655template< typename core_t >
     1656const ast::Type * ast::Pass< core_t >::visit( const ast::ArrayType * node ) {
    16571657        VISIT_START( node );
    16581658
     
    16671667//--------------------------------------------------------------------------
    16681668// ReferenceType
    1669 template< typename pass_t >
    1670 const ast::Type * ast::Pass< pass_t >::visit( const ast::ReferenceType * node ) {
     1669template< typename core_t >
     1670const ast::Type * ast::Pass< core_t >::visit( const ast::ReferenceType * node ) {
    16711671        VISIT_START( node );
    16721672
     
    16801680//--------------------------------------------------------------------------
    16811681// QualifiedType
    1682 template< typename pass_t >
    1683 const ast::Type * ast::Pass< pass_t >::visit( const ast::QualifiedType * node ) {
     1682template< typename core_t >
     1683const ast::Type * ast::Pass< core_t >::visit( const ast::QualifiedType * node ) {
    16841684        VISIT_START( node );
    16851685
     
    16941694//--------------------------------------------------------------------------
    16951695// FunctionType
    1696 template< typename pass_t >
    1697 const ast::Type * ast::Pass< pass_t >::visit( const ast::FunctionType * node ) {
     1696template< typename core_t >
     1697const ast::Type * ast::Pass< core_t >::visit( const ast::FunctionType * node ) {
    16981698        VISIT_START( node );
    16991699
     
    17101710//--------------------------------------------------------------------------
    17111711// StructInstType
    1712 template< typename pass_t >
    1713 const ast::Type * ast::Pass< pass_t >::visit( const ast::StructInstType * node ) {
    1714         VISIT_START( node );
    1715 
    1716         __pass::symtab::addStruct( pass, 0, node->name );
     1712template< typename core_t >
     1713const ast::Type * ast::Pass< core_t >::visit( const ast::StructInstType * node ) {
     1714        VISIT_START( node );
     1715
     1716        __pass::symtab::addStruct( core, 0, node->name );
    17171717
    17181718        VISIT({
     
    17281728//--------------------------------------------------------------------------
    17291729// UnionInstType
    1730 template< typename pass_t >
    1731 const ast::Type * ast::Pass< pass_t >::visit( const ast::UnionInstType * node ) {
    1732         VISIT_START( node );
    1733 
    1734         __pass::symtab::addUnion( pass, 0, node->name );
     1730template< typename core_t >
     1731const ast::Type * ast::Pass< core_t >::visit( const ast::UnionInstType * node ) {
     1732        VISIT_START( node );
     1733
     1734        __pass::symtab::addUnion( core, 0, node->name );
    17351735
    17361736        VISIT({
     
    17461746//--------------------------------------------------------------------------
    17471747// EnumInstType
    1748 template< typename pass_t >
    1749 const ast::Type * ast::Pass< pass_t >::visit( const ast::EnumInstType * node ) {
     1748template< typename core_t >
     1749const ast::Type * ast::Pass< core_t >::visit( const ast::EnumInstType * node ) {
    17501750        VISIT_START( node );
    17511751
     
    17611761//--------------------------------------------------------------------------
    17621762// TraitInstType
    1763 template< typename pass_t >
    1764 const ast::Type * ast::Pass< pass_t >::visit( const ast::TraitInstType * node ) {
     1763template< typename core_t >
     1764const ast::Type * ast::Pass< core_t >::visit( const ast::TraitInstType * node ) {
    17651765        VISIT_START( node );
    17661766
     
    17761776//--------------------------------------------------------------------------
    17771777// TypeInstType
    1778 template< typename pass_t >
    1779 const ast::Type * ast::Pass< pass_t >::visit( const ast::TypeInstType * node ) {
     1778template< typename core_t >
     1779const ast::Type * ast::Pass< core_t >::visit( const ast::TypeInstType * node ) {
    17801780        VISIT_START( node );
    17811781
     
    17871787                }
    17881788                // ensure that base re-bound if doing substitution
    1789                 __pass::forall::replace( pass, 0, node );
     1789                __pass::forall::replace( core, 0, node );
    17901790        )
    17911791
     
    17951795//--------------------------------------------------------------------------
    17961796// TupleType
    1797 template< typename pass_t >
    1798 const ast::Type * ast::Pass< pass_t >::visit( const ast::TupleType * node ) {
     1797template< typename core_t >
     1798const ast::Type * ast::Pass< core_t >::visit( const ast::TupleType * node ) {
    17991799        VISIT_START( node );
    18001800
     
    18091809//--------------------------------------------------------------------------
    18101810// TypeofType
    1811 template< typename pass_t >
    1812 const ast::Type * ast::Pass< pass_t >::visit( const ast::TypeofType * node ) {
     1811template< typename core_t >
     1812const ast::Type * ast::Pass< core_t >::visit( const ast::TypeofType * node ) {
    18131813        VISIT_START( node );
    18141814
     
    18221822//--------------------------------------------------------------------------
    18231823// VarArgsType
    1824 template< typename pass_t >
    1825 const ast::Type * ast::Pass< pass_t >::visit( const ast::VarArgsType * node ) {
     1824template< typename core_t >
     1825const ast::Type * ast::Pass< core_t >::visit( const ast::VarArgsType * node ) {
    18261826        VISIT_START( node );
    18271827
     
    18311831//--------------------------------------------------------------------------
    18321832// ZeroType
    1833 template< typename pass_t >
    1834 const ast::Type * ast::Pass< pass_t >::visit( const ast::ZeroType * node ) {
     1833template< typename core_t >
     1834const ast::Type * ast::Pass< core_t >::visit( const ast::ZeroType * node ) {
    18351835        VISIT_START( node );
    18361836
     
    18401840//--------------------------------------------------------------------------
    18411841// OneType
    1842 template< typename pass_t >
    1843 const ast::Type * ast::Pass< pass_t >::visit( const ast::OneType * node ) {
     1842template< typename core_t >
     1843const ast::Type * ast::Pass< core_t >::visit( const ast::OneType * node ) {
    18441844        VISIT_START( node );
    18451845
     
    18491849//--------------------------------------------------------------------------
    18501850// GlobalScopeType
    1851 template< typename pass_t >
    1852 const ast::Type * ast::Pass< pass_t >::visit( const ast::GlobalScopeType * node ) {
     1851template< typename core_t >
     1852const ast::Type * ast::Pass< core_t >::visit( const ast::GlobalScopeType * node ) {
    18531853        VISIT_START( node );
    18541854
     
    18591859//--------------------------------------------------------------------------
    18601860// Designation
    1861 template< typename pass_t >
    1862 const ast::Designation * ast::Pass< pass_t >::visit( const ast::Designation * node ) {
     1861template< typename core_t >
     1862const ast::Designation * ast::Pass< core_t >::visit( const ast::Designation * node ) {
    18631863        VISIT_START( node );
    18641864
     
    18701870//--------------------------------------------------------------------------
    18711871// SingleInit
    1872 template< typename pass_t >
    1873 const ast::Init * ast::Pass< pass_t >::visit( const ast::SingleInit * node ) {
     1872template< typename core_t >
     1873const ast::Init * ast::Pass< core_t >::visit( const ast::SingleInit * node ) {
    18741874        VISIT_START( node );
    18751875
     
    18831883//--------------------------------------------------------------------------
    18841884// ListInit
    1885 template< typename pass_t >
    1886 const ast::Init * ast::Pass< pass_t >::visit( const ast::ListInit * node ) {
     1885template< typename core_t >
     1886const ast::Init * ast::Pass< core_t >::visit( const ast::ListInit * node ) {
    18871887        VISIT_START( node );
    18881888
     
    18971897//--------------------------------------------------------------------------
    18981898// ConstructorInit
    1899 template< typename pass_t >
    1900 const ast::Init * ast::Pass< pass_t >::visit( const ast::ConstructorInit * node ) {
     1899template< typename core_t >
     1900const ast::Init * ast::Pass< core_t >::visit( const ast::ConstructorInit * node ) {
    19011901        VISIT_START( node );
    19021902
     
    19121912//--------------------------------------------------------------------------
    19131913// Attribute
    1914 template< typename pass_t >
    1915 const ast::Attribute * ast::Pass< pass_t >::visit( const ast::Attribute * node  )  {
     1914template< typename core_t >
     1915const ast::Attribute * ast::Pass< core_t >::visit( const ast::Attribute * node  )  {
    19161916        VISIT_START( node );
    19171917
     
    19251925//--------------------------------------------------------------------------
    19261926// TypeSubstitution
    1927 template< typename pass_t >
    1928 const ast::TypeSubstitution * ast::Pass< pass_t >::visit( const ast::TypeSubstitution * node ) {
     1927template< typename core_t >
     1928const ast::TypeSubstitution * ast::Pass< core_t >::visit( const ast::TypeSubstitution * node ) {
    19291929        VISIT_START( node );
    19301930
  • src/AST/Pass.proto.hpp

    r7f66cec rf8d05ee  
    2020
    2121namespace ast {
    22 template<typename pass_type>
     22template<typename core_t>
    2323class Pass;
    2424
     
    113113        /// "Short hand" to check if this is a valid previsit function
    114114        /// Mostly used to make the static_assert look (and print) prettier
    115         template<typename pass_t, typename node_t>
     115        template<typename core_t, typename node_t>
    116116        struct is_valid_previsit {
    117                 using ret_t = decltype( ((pass_t*)nullptr)->previsit( (const node_t *)nullptr ) );
     117                using ret_t = decltype( ((core_t*)nullptr)->previsit( (const node_t *)nullptr ) );
    118118
    119119                static constexpr bool value = std::is_void< ret_t >::value ||
     
    129129        template<>
    130130        struct __assign<true> {
    131                 template<typename pass_t, typename node_t>
    132                 static inline void result( pass_t & pass, const node_t * & node ) {
    133                         pass.previsit( node );
     131                template<typename core_t, typename node_t>
     132                static inline void result( core_t & core, const node_t * & node ) {
     133                        core.previsit( node );
    134134                }
    135135        };
     
    137137        template<>
    138138        struct __assign<false> {
    139                 template<typename pass_t, typename node_t>
    140                 static inline void result( pass_t & pass, const node_t * & node ) {
    141                         node = pass.previsit( node );
     139                template<typename core_t, typename node_t>
     140                static inline void result( core_t & core, const node_t * & node ) {
     141                        node = core.previsit( node );
    142142                        assertf(node, "Previsit must not return NULL");
    143143                }
     
    152152        template<>
    153153        struct __return<true> {
    154                 template<typename pass_t, typename node_t>
    155                 static inline const node_t * result( pass_t & pass, const node_t * & node ) {
    156                         pass.postvisit( node );
     154                template<typename core_t, typename node_t>
     155                static inline const node_t * result( core_t & core, const node_t * & node ) {
     156                        core.postvisit( node );
    157157                        return node;
    158158                }
     
    161161        template<>
    162162        struct __return<false> {
    163                 template<typename pass_t, typename node_t>
    164                 static inline auto result( pass_t & pass, const node_t * & node ) {
    165                         return pass.postvisit( node );
     163                template<typename core_t, typename node_t>
     164                static inline auto result( core_t & core, const node_t * & node ) {
     165                        return core.postvisit( node );
    166166                }
    167167        };
     
    182182        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    183183        // PreVisit : may mutate the pointer passed in if the node is mutated in the previsit call
    184         template<typename pass_t, typename node_t>
    185         static inline auto previsit( pass_t & pass, const node_t * & node, int ) -> decltype( pass.previsit( node ), void() ) {
     184        template<typename core_t, typename node_t>
     185        static inline auto previsit( core_t & core, const node_t * & node, int ) -> decltype( core.previsit( node ), void() ) {
    186186                static_assert(
    187                         is_valid_previsit<pass_t, node_t>::value,
     187                        is_valid_previsit<core_t, node_t>::value,
    188188                        "Previsit may not change the type of the node. It must return its paremeter or void."
    189189                );
     
    191191                __assign<
    192192                        std::is_void<
    193                                 decltype( pass.previsit( node ) )
     193                                decltype( core.previsit( node ) )
    194194                        >::value
    195                 >::result( pass, node );
     195                >::result( core, node );
    196196        }
    197197
    198         template<typename pass_t, typename node_t>
    199         static inline auto previsit( pass_t &, const node_t *, long ) {}
     198        template<typename core_t, typename node_t>
     199        static inline auto previsit( core_t &, const node_t *, long ) {}
    200200
    201201        // PostVisit : never mutates the passed pointer but may return a different node
    202         template<typename pass_t, typename node_t>
    203         static inline auto postvisit( pass_t & pass, const node_t * node, int ) ->
    204                 decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) )
     202        template<typename core_t, typename node_t>
     203        static inline auto postvisit( core_t & core, const node_t * node, int ) ->
     204                decltype( core.postvisit( node ), node->accept( *(Visitor*)nullptr ) )
    205205        {
    206206                return __return<
    207207                        std::is_void<
    208                                 decltype( pass.postvisit( node ) )
     208                                decltype( core.postvisit( node ) )
    209209                        >::value
    210                 >::result( pass, node );
     210                >::result( core, node );
    211211        }
    212212
    213         template<typename pass_t, typename node_t>
    214         static inline const node_t * postvisit( pass_t &, const node_t * node, long ) { return node; }
     213        template<typename core_t, typename node_t>
     214        static inline const node_t * postvisit( core_t &, const node_t * node, long ) { return node; }
    215215
    216216        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    227227        // The type is not strictly enforced but does match the accessory
    228228        #define FIELD_PTR( name, default_type ) \
    229         template< typename pass_t > \
    230         static inline auto name( pass_t & pass, int ) -> decltype( &pass.name ) { return &pass.name; } \
     229        template< typename core_t > \
     230        static inline auto name( core_t & core, int ) -> decltype( &core.name ) { return &core.name; } \
    231231        \
    232         template< typename pass_t > \
    233         static inline default_type * name( pass_t &, long ) { return nullptr; }
     232        template< typename core_t > \
     233        static inline default_type * name( core_t &, long ) { return nullptr; }
    234234
    235235        // List of fields and their expected types
     
    241241        FIELD_PTR( visit_children, __pass::bool_ref )
    242242        FIELD_PTR( at_cleanup, __pass::at_cleanup_t )
    243         FIELD_PTR( visitor, ast::Pass<pass_t> * const )
     243        FIELD_PTR( visitor, ast::Pass<core_t> * const )
    244244
    245245        // Remove the macro to make sure we don't clash
    246246        #undef FIELD_PTR
    247247
    248         template< typename pass_t >
    249         static inline auto beginTrace(pass_t &, int) -> decltype( pass_t::traceId, void() ) {
    250                 // Stats::Heap::stacktrace_push(pass_t::traceId);
     248        template< typename core_t >
     249        static inline auto beginTrace(core_t &, int) -> decltype( core_t::traceId, void() ) {
     250                // Stats::Heap::stacktrace_push(core_t::traceId);
    251251        }
    252252
    253         template< typename pass_t >
    254         static inline auto endTrace(pass_t &, int) -> decltype( pass_t::traceId, void() ) {
     253        template< typename core_t >
     254        static inline auto endTrace(core_t &, int) -> decltype( core_t::traceId, void() ) {
    255255                // Stats::Heap::stacktrace_pop();
    256256        }
    257257
    258         template< typename pass_t >
    259         static void beginTrace(pass_t &, long) {}
    260 
    261         template< typename pass_t >
    262         static void endTrace(pass_t &, long) {}
     258        template< typename core_t >
     259        static void beginTrace(core_t &, long) {}
     260
     261        template< typename core_t >
     262        static void endTrace(core_t &, long) {}
    263263
    264264        // Another feature of the templated visitor is that it calls beginScope()/endScope() for compound statement.
     
    266266        // detect it using the same strategy
    267267        namespace scope {
    268                 template<typename pass_t>
    269                 static inline auto enter( pass_t & pass, int ) -> decltype( pass.beginScope(), void() ) {
    270                         pass.beginScope();
    271                 }
    272 
    273                 template<typename pass_t>
    274                 static inline void enter( pass_t &, long ) {}
    275 
    276                 template<typename pass_t>
    277                 static inline auto leave( pass_t & pass, int ) -> decltype( pass.endScope(), void() ) {
    278                         pass.endScope();
    279                 }
    280 
    281                 template<typename pass_t>
    282                 static inline void leave( pass_t &, long ) {}
     268                template<typename core_t>
     269                static inline auto enter( core_t & core, int ) -> decltype( core.beginScope(), void() ) {
     270                        core.beginScope();
     271                }
     272
     273                template<typename core_t>
     274                static inline void enter( core_t &, long ) {}
     275
     276                template<typename core_t>
     277                static inline auto leave( core_t & core, int ) -> decltype( core.endScope(), void() ) {
     278                        core.endScope();
     279                }
     280
     281                template<typename core_t>
     282                static inline void leave( core_t &, long ) {}
    283283        } // namespace scope
    284284
     
    287287        namespace symtab {
    288288                // Some simple scoping rules
    289                 template<typename pass_t>
    290                 static inline auto enter( pass_t & pass, int ) -> decltype( pass.symtab, void() ) {
    291                         pass.symtab.enterScope();
    292                 }
    293 
    294                 template<typename pass_t>
    295                 static inline auto enter( pass_t &, long ) {}
    296 
    297                 template<typename pass_t>
    298                 static inline auto leave( pass_t & pass, int ) -> decltype( pass.symtab, void() ) {
    299                         pass.symtab.leaveScope();
    300                 }
    301 
    302                 template<typename pass_t>
    303                 static inline auto leave( pass_t &, long ) {}
     289                template<typename core_t>
     290                static inline auto enter( core_t & core, int ) -> decltype( core.symtab, void() ) {
     291                        core.symtab.enterScope();
     292                }
     293
     294                template<typename core_t>
     295                static inline auto enter( core_t &, long ) {}
     296
     297                template<typename core_t>
     298                static inline auto leave( core_t & core, int ) -> decltype( core.symtab, void() ) {
     299                        core.symtab.leaveScope();
     300                }
     301
     302                template<typename core_t>
     303                static inline auto leave( core_t &, long ) {}
    304304
    305305                // The symbol table has 2 kind of functions mostly, 1 argument and 2 arguments
    306306                // Create macro to condense these common patterns
    307307                #define SYMTAB_FUNC1( func, type ) \
    308                 template<typename pass_t> \
    309                 static inline auto func( pass_t & pass, int, type arg ) -> decltype( pass.symtab.func( arg ), void() ) {\
    310                         pass.symtab.func( arg ); \
     308                template<typename core_t> \
     309                static inline auto func( core_t & core, int, type arg ) -> decltype( core.symtab.func( arg ), void() ) {\
     310                        core.symtab.func( arg ); \
    311311                } \
    312312                \
    313                 template<typename pass_t> \
    314                 static inline void func( pass_t &, long, type ) {}
     313                template<typename core_t> \
     314                static inline void func( core_t &, long, type ) {}
    315315
    316316                #define SYMTAB_FUNC2( func, type1, type2 ) \
    317                 template<typename pass_t> \
    318                 static inline auto func( pass_t & pass, int, type1 arg1, type2 arg2 ) -> decltype( pass.symtab.func( arg1, arg2 ), void () ) {\
    319                         pass.symtab.func( arg1, arg2 ); \
     317                template<typename core_t> \
     318                static inline auto func( core_t & core, int, type1 arg1, type2 arg2 ) -> decltype( core.symtab.func( arg1, arg2 ), void () ) {\
     319                        core.symtab.func( arg1, arg2 ); \
    320320                } \
    321321                        \
    322                 template<typename pass_t> \
    323                 static inline void func( pass_t &, long, type1, type2 ) {}
     322                template<typename core_t> \
     323                static inline void func( core_t &, long, type1, type2 ) {}
    324324
    325325                SYMTAB_FUNC1( addId     , const DeclWithType *  );
     
    332332
    333333                // A few extra functions have more complicated behaviour, they are hand written
    334                 template<typename pass_t>
    335                 static inline auto addStructFwd( pass_t & pass, int, const ast::StructDecl * decl ) -> decltype( pass.symtab.addStruct( decl ), void() ) {
     334                template<typename core_t>
     335                static inline auto addStructFwd( core_t & core, int, const ast::StructDecl * decl ) -> decltype( core.symtab.addStruct( decl ), void() ) {
    336336                        ast::StructDecl * fwd = new ast::StructDecl( decl->location, decl->name );
    337337                        fwd->params = decl->params;
    338                         pass.symtab.addStruct( fwd );
    339                 }
    340 
    341                 template<typename pass_t>
    342                 static inline void addStructFwd( pass_t &, long, const ast::StructDecl * ) {}
    343 
    344                 template<typename pass_t>
    345                 static inline auto addUnionFwd( pass_t & pass, int, const ast::UnionDecl * decl ) -> decltype( pass.symtab.addUnion( decl ), void() ) {
     338                        core.symtab.addStruct( fwd );
     339                }
     340
     341                template<typename core_t>
     342                static inline void addStructFwd( core_t &, long, const ast::StructDecl * ) {}
     343
     344                template<typename core_t>
     345                static inline auto addUnionFwd( core_t & core, int, const ast::UnionDecl * decl ) -> decltype( core.symtab.addUnion( decl ), void() ) {
    346346                        UnionDecl * fwd = new UnionDecl( decl->location, decl->name );
    347347                        fwd->params = decl->params;
    348                         pass.symtab.addUnion( fwd );
    349                 }
    350 
    351                 template<typename pass_t>
    352                 static inline void addUnionFwd( pass_t &, long, const ast::UnionDecl * ) {}
    353 
    354                 template<typename pass_t>
    355                 static inline auto addStruct( pass_t & pass, int, const std::string & str ) -> decltype( pass.symtab.addStruct( str ), void() ) {
    356                         if ( ! pass.symtab.lookupStruct( str ) ) {
    357                                 pass.symtab.addStruct( str );
     348                        core.symtab.addUnion( fwd );
     349                }
     350
     351                template<typename core_t>
     352                static inline void addUnionFwd( core_t &, long, const ast::UnionDecl * ) {}
     353
     354                template<typename core_t>
     355                static inline auto addStruct( core_t & core, int, const std::string & str ) -> decltype( core.symtab.addStruct( str ), void() ) {
     356                        if ( ! core.symtab.lookupStruct( str ) ) {
     357                                core.symtab.addStruct( str );
    358358                        }
    359359                }
    360360
    361                 template<typename pass_t>
    362                 static inline void addStruct( pass_t &, long, const std::string & ) {}
    363 
    364                 template<typename pass_t>
    365                 static inline auto addUnion( pass_t & pass, int, const std::string & str ) -> decltype( pass.symtab.addUnion( str ), void() ) {
    366                         if ( ! pass.symtab.lookupUnion( str ) ) {
    367                                 pass.symtab.addUnion( str );
     361                template<typename core_t>
     362                static inline void addStruct( core_t &, long, const std::string & ) {}
     363
     364                template<typename core_t>
     365                static inline auto addUnion( core_t & core, int, const std::string & str ) -> decltype( core.symtab.addUnion( str ), void() ) {
     366                        if ( ! core.symtab.lookupUnion( str ) ) {
     367                                core.symtab.addUnion( str );
    368368                        }
    369369                }
    370370
    371                 template<typename pass_t>
    372                 static inline void addUnion( pass_t &, long, const std::string & ) {}
     371                template<typename core_t>
     372                static inline void addUnion( core_t &, long, const std::string & ) {}
    373373
    374374                #undef SYMTAB_FUNC1
     
    380380        namespace forall {
    381381                // Some simple scoping rules
    382                 template<typename pass_t>
    383                 static inline auto enter( pass_t & pass, int, const ast::ParameterizedType * type )
    384                 -> decltype( pass.subs, void() ) {
    385                         if ( ! type->forall.empty() ) pass.subs.beginScope();
    386                 }
    387 
    388                 template<typename pass_t>
    389                 static inline auto enter( pass_t &, long, const ast::ParameterizedType * ) {}
    390 
    391                 template<typename pass_t>
    392                 static inline auto leave( pass_t & pass, int, const ast::ParameterizedType * type )
    393                 -> decltype( pass.subs, void() ) {
    394                         if ( ! type->forall.empty() ) { pass.subs.endScope(); }
    395                 }
    396 
    397                 template<typename pass_t>
    398                 static inline auto leave( pass_t &, long, const ast::ParameterizedType * ) {}
     382                template<typename core_t>
     383                static inline auto enter( core_t & core, int, const ast::ParameterizedType * type )
     384                -> decltype( core.subs, void() ) {
     385                        if ( ! type->forall.empty() ) core.subs.beginScope();
     386                }
     387
     388                template<typename core_t>
     389                static inline auto enter( core_t &, long, const ast::ParameterizedType * ) {}
     390
     391                template<typename core_t>
     392                static inline auto leave( core_t & core, int, const ast::ParameterizedType * type )
     393                -> decltype( core.subs, void() ) {
     394                        if ( ! type->forall.empty() ) { core.subs.endScope(); }
     395                }
     396
     397                template<typename core_t>
     398                static inline auto leave( core_t &, long, const ast::ParameterizedType * ) {}
    399399
    400400                // Get the substitution table, if present
    401                 template<typename pass_t>
    402                 static inline auto subs( pass_t & pass, int ) -> decltype( &pass.subs ) {
    403                         return &pass.subs;
    404                 }
    405 
    406                 template<typename pass_t>
    407                 static inline ast::ForallSubstitutionTable * subs( pass_t &, long ) { return nullptr; }
     401                template<typename core_t>
     402                static inline auto subs( core_t & core, int ) -> decltype( &core.subs ) {
     403                        return &core.subs;
     404                }
     405
     406                template<typename core_t>
     407                static inline ast::ForallSubstitutionTable * subs( core_t &, long ) { return nullptr; }
    408408
    409409                // Replaces a TypeInstType's base TypeDecl according to the table
    410                 template<typename pass_t>
    411                 static inline auto replace( pass_t & pass, int, const ast::TypeInstType *& inst )
    412                 -> decltype( pass.subs, void() ) {
     410                template<typename core_t>
     411                static inline auto replace( core_t & core, int, const ast::TypeInstType *& inst )
     412                -> decltype( core.subs, void() ) {
    413413                        inst = ast::mutate_field(
    414                                 inst, &ast::TypeInstType::base, pass.subs.replace( inst->base ) );
    415                 }
    416 
    417                 template<typename pass_t>
    418                 static inline auto replace( pass_t &, long, const ast::TypeInstType *& ) {}
     414                                inst, &ast::TypeInstType::base, core.subs.replace( inst->base ) );
     415                }
     416
     417                template<typename core_t>
     418                static inline auto replace( core_t &, long, const ast::TypeInstType *& ) {}
    419419
    420420        } // namespace forall
  • src/AST/Type.cpp

    r7f66cec rf8d05ee  
    9494// --- ParameterizedType
    9595
    96 void ParameterizedType::initWithSub( 
    97         const ParameterizedType & o, Pass< ForallSubstitutor > & sub 
     96void ParameterizedType::initWithSub(
     97        const ParameterizedType & o, Pass< ForallSubstitutor > & sub
    9898) {
    99         forall = sub.pass( o.forall );
     99        forall = sub.core( o.forall );
    100100}
    101101
     
    103103
    104104FunctionType::FunctionType( const FunctionType & o )
    105 : ParameterizedType( o.qualifiers, copy( o.attributes ) ), returns(), params(), 
     105: ParameterizedType( o.qualifiers, copy( o.attributes ) ), returns(), params(),
    106106  isVarArgs( o.isVarArgs ) {
    107107        Pass< ForallSubstitutor > sub;
    108108        initWithSub( o, sub );           // initialize substitution map
    109         returns = sub.pass( o.returns ); // apply to return and parameter types
    110         params = sub.pass( o.params );
     109        returns = sub.core( o.returns ); // apply to return and parameter types
     110        params = sub.core( o.params );
    111111}
    112112
     
    128128void ReferenceToType::initWithSub( const ReferenceToType & o, Pass< ForallSubstitutor > & sub ) {
    129129        ParameterizedType::initWithSub( o, sub ); // initialize substitution
    130         params = sub.pass( o.params );            // apply to parameters
     130        params = sub.core( o.params );            // apply to parameters
    131131}
    132132
     
    166166// --- TraitInstType
    167167
    168 TraitInstType::TraitInstType( 
     168TraitInstType::TraitInstType(
    169169        const TraitDecl * b, CV::Qualifiers q, std::vector<ptr<Attribute>>&& as )
    170170: ReferenceToType( b->name, q, move(as) ), base( b ) {}
     
    172172// --- TypeInstType
    173173
    174 TypeInstType::TypeInstType( const TypeInstType & o ) 
     174TypeInstType::TypeInstType( const TypeInstType & o )
    175175: ReferenceToType( o.name, o.qualifiers, copy( o.attributes ) ), base(), kind( o.kind ) {
    176176        Pass< ForallSubstitutor > sub;
    177177        initWithSub( o, sub );      // initialize substitution
    178         base = sub.pass( o.base );  // apply to base type
     178        base = sub.core( o.base );  // apply to base type
    179179}
    180180
  • src/AST/TypeEnvironment.cpp

    r7f66cec rf8d05ee  
    5959        std::copy( clz.vars.begin(), clz.vars.end(), std::ostream_iterator< std::string >( out, " " ) );
    6060        out << ")";
    61        
     61
    6262        if ( clz.bound ) {
    6363                out << " -> ";
     
    9292                                }
    9393                        }
    94                        
     94
    9595                        i = next;  // go to next node even if this removed
    9696                }
     
    161161                Pass<Occurs> occur{ var, env };
    162162                maybe_accept( ty, occur );
    163                 return occur.pass.result;
    164         }
    165 }
    166 
    167 bool TypeEnvironment::combine( 
     163                return occur.core.result;
     164        }
     165}
     166
     167bool TypeEnvironment::combine(
    168168                const TypeEnvironment & o, OpenVarSet & open, const SymbolTable & symtab ) {
    169169        // short-circuit easy cases
     
    199199                                auto st = internal_lookup( *vt );
    200200                                if ( st == env.end() ) {
    201                                         // unbound, safe to add if occurs 
     201                                        // unbound, safe to add if occurs
    202202                                        if ( r.bound && occurs( r.bound, *vt, *this ) ) return false;
    203203                                        r.vars.emplace( *vt );
     
    266266}
    267267
    268 bool TypeEnvironment::bindVar( 
    269                 const TypeInstType * typeInst, const Type * bindTo, const TypeDecl::Data & data, 
    270                 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen, 
    271                 const SymbolTable & symtab 
     268bool TypeEnvironment::bindVar(
     269                const TypeInstType * typeInst, const Type * bindTo, const TypeDecl::Data & data,
     270                AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen,
     271                const SymbolTable & symtab
    272272) {
    273273        // remove references from bound type, so that type variables can only bind to value types
     
    286286                        ptr<Type> newType = it->bound;
    287287                        reset_qualifiers( newType, typeInst->qualifiers );
    288                         if ( unifyInexact( 
    289                                         newType, target, *this, need, have, open, 
     288                        if ( unifyInexact(
     289                                        newType, target, *this, need, have, open,
    290290                                        widen & WidenMode{ it->allowWidening, true }, symtab, common ) ) {
    291291                                if ( common ) {
     
    300300                }
    301301        } else {
    302                 env.emplace_back( 
     302                env.emplace_back(
    303303                        typeInst->name, target, widen.first && widen.second, data );
    304304        }
     
    306306}
    307307
    308 bool TypeEnvironment::bindVarToVar( 
    309                 const TypeInstType * var1, const TypeInstType * var2, TypeDecl::Data && data, 
    310                 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, 
    311                 WidenMode widen, const SymbolTable & symtab 
     308bool TypeEnvironment::bindVarToVar(
     309                const TypeInstType * var1, const TypeInstType * var2, TypeDecl::Data && data,
     310                AssertionSet & need, AssertionSet & have, const OpenVarSet & open,
     311                WidenMode widen, const SymbolTable & symtab
    312312) {
    313313        auto c1 = internal_lookup( var1->name );
    314314        auto c2 = internal_lookup( var2->name );
    315        
     315
    316316        // exit early if variables already bound together
    317317        if ( c1 != env.end() && c1 == c2 ) {
     
    396396}
    397397
    398 bool TypeEnvironment::mergeBound( 
     398bool TypeEnvironment::mergeBound(
    399399                EqvClass & to, const EqvClass & from, OpenVarSet & open, const SymbolTable & symtab ) {
    400400        if ( from.bound ) {
     
    406406                        AssertionSet need, have;
    407407
    408                         if ( unifyInexact( 
     408                        if ( unifyInexact(
    409409                                        toType, fromType, *this, need, have, open, widen, symtab, common ) ) {
    410410                                // unifies, set common type if necessary
     
    424424}
    425425
    426 bool TypeEnvironment::mergeClasses( 
     426bool TypeEnvironment::mergeClasses(
    427427        ClassList::iterator to, ClassList::iterator from, OpenVarSet & open, const SymbolTable & symtab
    428428) {
  • src/AST/TypeSubstitution.cpp

    r7f66cec rf8d05ee  
    121121        Pass<Substituter> sub( *this, true );
    122122        do {
    123                 sub.pass.subCount = 0;
    124                 sub.pass.freeOnly = true;
     123                sub.core.subCount = 0;
     124                sub.core.freeOnly = true;
    125125                for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {
    126126                        i->second = i->second->accept( sub );
    127127                }
    128         } while ( sub.pass.subCount );
     128        } while ( sub.core.subCount );
    129129}
    130130
  • src/AST/TypeSubstitution.hpp

    r7f66cec rf8d05ee  
    9999        void initialize( const TypeSubstitution &src, TypeSubstitution &dest );
    100100
    101         template<typename pass_type>
     101        template<typename core_t>
    102102        friend class Pass;
    103103
     
    188188        Pass<Substituter> sub( *this, false );
    189189        input = strict_dynamic_cast< const SynTreeClass * >( deepCopy(input)->accept( sub ) );
    190         return { input, sub.pass.subCount };
     190        return { input, sub.core.subCount };
    191191}
    192192
     
    196196        Pass<Substituter> sub( *this, true );
    197197        input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) );
    198         return { input, sub.pass.subCount };
     198        return { input, sub.core.subCount };
    199199}
    200200
  • src/Common/Eval.cc

    r7f66cec rf8d05ee  
    168168        if (expr) {
    169169                expr->accept(ev);
    170                 return std::make_pair(ev.pass.value, ev.pass.valid);
     170                return std::make_pair(ev.core.value, ev.core.valid);
    171171        } else {
    172172                return std::make_pair(0, false);
  • src/InitTweak/InitTweak.cc

    r7f66cec rf8d05ee  
    127127        ast::Pass< InitFlattener_new > flattener;
    128128        maybe_accept( init, flattener );
    129         return std::move( flattener.pass.argList );
     129        return std::move( flattener.core.argList );
    130130}
    131131
     
    561561                ast::Pass< CallFinder_new > finder{ std::vector< std::string >{ "?{}", "^?{}" } };
    562562                maybe_accept( stmt, finder );
    563                 return std::move( finder.pass.matches );
     563                return std::move( finder.core.matches );
    564564        }
    565565
  • src/ResolvExpr/CandidateFinder.cpp

    r7f66cec rf8d05ee  
    15901590
    15911591        if ( mode.failFast && candidates.empty() ) {
    1592                 switch(finder.pass.reason.code) {
     1592                switch(finder.core.reason.code) {
    15931593                case Finder::NotFound:
    15941594                        { SemanticError( expr, "No alternatives for expression " ); break; }
  • src/ResolvExpr/CastCost.cc

    r7f66cec rf8d05ee  
    242242                        dst, srcIsLvalue, symtab, env, localCastCost );
    243243                src->accept( converter );
    244                 return converter.pass.cost;
     244                return converter.core.cost;
    245245        }
    246246}
  • src/ResolvExpr/CommonType.cc

    r7f66cec rf8d05ee  
    968968                ast::Pass<CommonType_new> visitor{ type2, widen, symtab, env, open };
    969969                type1->accept( visitor );
    970                 ast::ptr< ast::Type > result = visitor.pass.result;
     970                ast::ptr< ast::Type > result = visitor.core.result;
    971971
    972972                // handling for opaque type declarations (?)
  • src/ResolvExpr/ConversionCost.cc

    r7f66cec rf8d05ee  
    522522                ast::Pass<ConversionCost_new> converter( dst, srcIsLvalue, symtab, env, localConversionCost );
    523523                src->accept( converter );
    524                 return converter.pass.cost;
     524                return converter.core.cost;
    525525        }
    526526}
     
    565565                        ast::Pass<ConversionCost_new> converter( dst, srcIsLvalue, symtab, env, localConversionCost );
    566566                        src->accept( converter );
    567                         return converter.pass.cost;
     567                        return converter.core.cost;
    568568                }
    569569        } else {
  • src/ResolvExpr/PolyCost.cc

    r7f66cec rf8d05ee  
    8787        ast::Pass<PolyCost_new> costing( symtab, env );
    8888        type->accept( costing );
    89         return costing.pass.result;
     89        return costing.core.result;
    9090}
    9191
  • src/ResolvExpr/PtrsAssignable.cc

    r7f66cec rf8d05ee  
    155155                ast::Pass<PtrsAssignable_new> visitor( dst, env );
    156156                src->accept( visitor );
    157                 return visitor.pass.result;
     157                return visitor.core.result;
    158158        }
    159159
  • src/ResolvExpr/PtrsCastable.cc

    r7f66cec rf8d05ee  
    293293                ast::Pass< PtrsCastable_new > ptrs{ dst, env, symtab };
    294294                src->accept( ptrs );
    295                 return ptrs.pass.result;
     295                return ptrs.core.result;
    296296        }
    297297}
  • src/ResolvExpr/Resolver.cc

    r7f66cec rf8d05ee  
    982982                ast::Pass<DeleteFinder_new> finder;
    983983                expr->accept( finder );
    984                 return finder.pass.delExpr;
     984                return finder.core.delExpr;
    985985        }
    986986
  • src/ResolvExpr/SpecCost.cc

    r7f66cec rf8d05ee  
    217217        }
    218218        ast::Pass<SpecCounter> counter;
    219         type->accept( *counter.pass.visitor );
    220         return counter.pass.get_count();
     219        type->accept( counter );
     220        return counter.core.get_count();
    221221}
    222222
  • src/ResolvExpr/Unify.cc

    r7f66cec rf8d05ee  
    11851185                        ast::Pass<Unify_new> comparator{ type2, env, need, have, open, widen, symtab };
    11861186                        type1->accept( comparator );
    1187                         return comparator.pass.result;
     1187                        return comparator.core.result;
    11881188                }
    11891189        }
  • src/SymTab/FixFunction.cc

    r7f66cec rf8d05ee  
    141141        ast::Pass< FixFunction_new > fixer;
    142142        dwt = dwt->accept( fixer );
    143         isVoid |= fixer.pass.isVoid;
     143        isVoid |= fixer.core.isVoid;
    144144        return dwt;
    145145}
  • src/SymTab/Mangler.cc

    r7f66cec rf8d05ee  
    447447                ast::Pass<Mangler_new> mangler( mode );
    448448                maybeAccept( decl, mangler );
    449                 return mangler.pass.get_mangleName();
     449                return mangler.core.get_mangleName();
    450450        }
    451451
     
    691691                                                                mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums );
    692692                                                        assert->accept( sub_mangler );
    693                                                         assertionNames.push_back( sub_mangler.pass.get_mangleName() );
     693                                                        assertionNames.push_back( sub_mangler.core.get_mangleName() );
    694694                                                        acount++;
    695695                                                } // for
  • src/Tuples/Explode.cc

    r7f66cec rf8d05ee  
    179179        ast::Pass<CastExploderCore> exploder;
    180180        expr = expr->accept( exploder );
    181         if ( ! exploder.pass.foundUniqueExpr ) {
     181        if ( ! exploder.core.foundUniqueExpr ) {
    182182                expr = new ast::CastExpr{ expr, new ast::ReferenceType{ expr->result } };
    183183        }
  • src/Tuples/Tuples.cc

    r7f66cec rf8d05ee  
    5353                ast::Pass<Detector> detector;
    5454                expr->accept( detector );
    55                 return detector.pass.maybeImpure;
     55                return detector.core.maybeImpure;
    5656        }
    5757} // namespace
Note: See TracChangeset for help on using the changeset viewer.