Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.h

    r843054c2 rebe9b3a  
    1717#define _SCRUBTYVARS_H
    1818
     19#include <string>
     20
    1921#include "GenPoly.h"
    2022
     
    2527        class ScrubTyVars : public Mutator {
    2628          public:
    27                 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
    28  
     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
    2933                template< typename SynTreeClass >
    3034                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
    31                 template< typename SynTreeClass >
    32                 static SynTreeClass *scrub( SynTreeClass *target );
    33  
     35
    3436                virtual Type* mutate( TypeInstType *typeInst );
    35                 Expression* mutate( SizeofExpr *szeof );
     37                virtual Type* mutate( StructInstType *structInst );
     38                virtual Type* mutate( UnionInstType *unionInst );
     39                virtual Expression* mutate( SizeofExpr *szeof );
     40                virtual Expression* mutate( AlignofExpr *algnof );
    3641                virtual Type* mutate( PointerType *pointer );
     42
    3743          private:
    38                 bool doAll;
     44                /// Mutates (possibly generic) aggregate types appropriately
     45                Type* mutateAggregateType( Type *ty );
     46               
    3947                const TyVarMap &tyVars;
    4048        };
     
    4351        template< typename SynTreeClass >
    4452        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
    45                 ScrubTyVars scrubber( false, tyVars );
     53                ScrubTyVars scrubber( tyVars );
    4654                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    4755        }
    4856
    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         }
    5657} // namespace GenPoly
    5758
Note: See TracChangeset for help on using the changeset viewer.