Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.h

    rebe9b3a rffad73a  
    2727        class ScrubTyVars : public Mutator {
    2828          public:
    29                 ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {}
     29                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
    3030
    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
     31                /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars`
    3332                template< typename SynTreeClass >
    3433                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
    35 
     34                /// Replaces dtypes and ftypes with the appropriate void type, and sizeof expressions of polymorphic types with the proper variable
     35                template< typename SynTreeClass >
     36                static SynTreeClass *scrub( SynTreeClass *target );
     37 
    3638                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 );
     39                Expression* mutate( SizeofExpr *szeof );
     40                Expression* mutate( AlignofExpr *algnof );
    4141                virtual Type* mutate( PointerType *pointer );
    42 
    4342          private:
    44                 /// Mutates (possibly generic) aggregate types appropriately
    45                 Type* mutateAggregateType( Type *ty );
    46                
     43                bool doAll;
    4744                const TyVarMap &tyVars;
    4845        };
     
    5148        template< typename SynTreeClass >
    5249        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
    53                 ScrubTyVars scrubber( tyVars );
     50                ScrubTyVars scrubber( false, tyVars );
    5451                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    5552        }
    5653
     54        /* static class method */
     55        template< typename SynTreeClass >
     56        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) {
     57                TyVarMap tyVars;
     58                ScrubTyVars scrubber( true, tyVars );
     59                return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
     60        }
    5761} // namespace GenPoly
    5862
Note: See TracChangeset for help on using the changeset viewer.