Changeset 90320ac for src/AST/Pass.hpp


Ignore:
Timestamp:
Apr 12, 2024, 3:10:04 PM (6 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
7a36848
Parents:
b78c54f
Message:

Clean-up in the Pass template around call_accept. Removed overloads that no longer contain unique behaviour. Redundent early exits have been removed. Updated the names and removed redundent checks following up the result* type update. New constructors for the delta helper type show how the data is actually used. The differs functions are unused (that value is stored in the result* types).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.hpp

    rb78c54f r90320ac  
    252252private:
    253253
    254         __pass::result1<ast::Stmt> call_accept( const ast::Stmt * );
    255         __pass::result1<ast::Expr> call_accept( const ast::Expr * );
    256 
    257         /// This has a `type` member that is the return type for the
    258         /// generic call_accept if the generic call_accept is defined.
     254        /// The return type of the general call_accept function.
    259255        template< typename node_t >
    260         using generic_call_accept_result =
    261                 std::enable_if<
    262                                 !std::is_base_of<ast::Expr, node_t>::value &&
    263                                 !std::is_base_of<ast::Stmt, node_t>::value
    264                         , __pass::result1<
    265                                 typename std::remove_pointer< typename std::result_of<
    266                                         decltype(&node_t::accept)(node_t*, type&) >::type >::type
    267                         >
     256        using call_accept_result_t = __pass::result1<
     257                typename std::remove_pointer< typename std::result_of<
     258                        decltype(&node_t::accept)(node_t*, type&) >::type >::type
    268259                >;
    269260
    270261        template< typename node_t >
    271         auto call_accept( const node_t * node )
    272                 -> typename generic_call_accept_result<node_t>::type;
     262        auto call_accept( const node_t * node ) -> call_accept_result_t<node_t>;
    273263
    274264        // requests WithStmtsToAdd directly add to this statement, as if it is a compound.
Note: See TracChangeset for help on using the changeset viewer.