Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.h

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