Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.h

    rea2ed3a rfad1f14  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Dec  7 16:57:00 2022
    13 // Update Count     : 5
     12// Last Modified On : Fri Oct  7 15:51:00 2022
     13// Update Count     : 4
    1414//
    1515
     
    109109        }
    110110
    111 // ScrubMode and scrubTypeVarsBase are internal.
    112 enum class ScrubMode { FromMap, DynamicFromMap, All };
    113 
    114 const ast::Node * scrubTypeVarsBase(
    115         const ast::Node * target, const TypeVarMap * typeVars, ScrubMode mode );
    116 
    117 
    118111/// For all polymorphic types with type variables in `typeVars`,
    119112/// replaces generic types, dtypes, and ftypes with the appropriate void type,
     
    123116                node_t const * target, const TypeVarMap & typeVars ) {
    124117        return strict_dynamic_cast<node_t const *>(
    125                         scrubTypeVarsBase( target, &typeVars, ScrubMode::FromMap ) );
     118                        scrubTypeVars<ast::Node>( target, typeVars ) );
    126119}
    127120
     
    130123/// and sizeof/alignof expressions with the proper variable.
    131124template<typename node_t>
    132 node_t const * scrubTypeVarsDynamic(
     125ast::Node const * scrubTypeVarsDynamic(
    133126                node_t const * target, const TypeVarMap & typeVars ) {
    134127        return strict_dynamic_cast<node_t const *>(
    135                         scrubTypeVarsBase( target, &typeVars, ScrubMode::DynamicFromMap ) );
     128                        scrubTypeVarsDynamic<ast::Node>( target, typeVars ) );
    136129}
    137130
     
    141134node_t const * scrubAllTypeVars( node_t const * target ) {
    142135        return strict_dynamic_cast<node_t const *>(
    143                         scrubTypeVarsBase( target, nullptr, ScrubMode::All ) );
     136                        scrubAllTypeVars<ast::Node>( target ) );
    144137}
     138
     139// We specialize for Node as a base case.
     140template<>
     141ast::Node const * scrubTypeVars<ast::Node>(
     142                const ast::Node * target, const TypeVarMap & typeVars );
     143
     144template<>
     145ast::Node const * scrubTypeVarsDynamic<ast::Node>(
     146                ast::Node const * target, const TypeVarMap & typeVars );
     147
     148template<>
     149ast::Node const * scrubAllTypeVars<ast::Node>( const ast::Node * target );
    145150
    146151} // namespace GenPoly
Note: See TracChangeset for help on using the changeset viewer.