Changes in src/GenPoly/ScrubTyVars.h [843054c2:ebe9b3a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/ScrubTyVars.h
r843054c2 rebe9b3a 17 17 #define _SCRUBTYVARS_H 18 18 19 #include <string> 20 19 21 #include "GenPoly.h" 20 22 … … 25 27 class ScrubTyVars : public Mutator { 26 28 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 29 33 template< typename SynTreeClass > 30 34 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 31 template< typename SynTreeClass > 32 static SynTreeClass *scrub( SynTreeClass *target ); 33 35 34 36 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 ); 36 41 virtual Type* mutate( PointerType *pointer ); 42 37 43 private: 38 bool doAll; 44 /// Mutates (possibly generic) aggregate types appropriately 45 Type* mutateAggregateType( Type *ty ); 46 39 47 const TyVarMap &tyVars; 40 48 }; … … 43 51 template< typename SynTreeClass > 44 52 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) { 45 ScrubTyVars scrubber( false,tyVars );53 ScrubTyVars scrubber( tyVars ); 46 54 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) ); 47 55 } 48 56 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 }56 57 } // namespace GenPoly 57 58
Note:
See TracChangeset
for help on using the changeset viewer.