Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.h

    rebe9b3a r843054c2  
    1717#define _SCRUBTYVARS_H
    1818
    19 #include <string>
    20 
    2119#include "GenPoly.h"
    2220
     
    2725        class ScrubTyVars : public Mutator {
    2826          public:
    29                 ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {}
    30 
    31                 /// For all polymorphic types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
    32                 /// and sizeof/alignof expressions with the proper variable
     27                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
     28 
    3329                template< typename SynTreeClass >
    3430                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
    35 
     31                template< typename SynTreeClass >
     32                static SynTreeClass *scrub( SynTreeClass *target );
     33 
    3634                virtual Type* mutate( TypeInstType *typeInst );
    37                 virtual Type* mutate( StructInstType *structInst );
    38                 virtual Type* mutate( UnionInstType *unionInst );
    39                 virtual Expression* mutate( SizeofExpr *szeof );
    40                 virtual Expression* mutate( AlignofExpr *algnof );
     35                Expression* mutate( SizeofExpr *szeof );
    4136                virtual Type* mutate( PointerType *pointer );
    42 
    4337          private:
    44                 /// Mutates (possibly generic) aggregate types appropriately
    45                 Type* mutateAggregateType( Type *ty );
    46                
     38                bool doAll;
    4739                const TyVarMap &tyVars;
    4840        };
     
    5143        template< typename SynTreeClass >
    5244        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
    53                 ScrubTyVars scrubber( tyVars );
     45                ScrubTyVars scrubber( false, tyVars );
    5446                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    5547        }
    5648
     49        /* static class method */
     50        template< typename SynTreeClass >
     51        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) {
     52                TyVarMap tyVars;
     53                ScrubTyVars scrubber( true, tyVars );
     54                return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
     55        }
    5756} // namespace GenPoly
    5857
Note: See TracChangeset for help on using the changeset viewer.