Changes in src/SynTree/TypeSubstitution.h [4040425:540de412]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/TypeSubstitution.h
r4040425 r540de412 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TypeSubstitution.h -- 7 // TypeSubstitution.h -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Mar 2 17:33:19201611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Apr 29 15:00:20 2016 13 13 // Update Count : 2 14 14 // … … 33 33 TypeSubstitution( const TypeSubstitution &other ); 34 34 virtual ~TypeSubstitution(); 35 35 36 36 TypeSubstitution &operator=( const TypeSubstitution &other ); 37 37 38 38 template< typename SynTreeClass > int apply( SynTreeClass *&input ); 39 39 template< typename SynTreeClass > int applyFree( SynTreeClass *&input ); 40 40 41 41 void add( std::string formalType, Type *actualType ); 42 42 void add( const TypeSubstitution &other ); … … 44 44 Type *lookup( std::string formalType ) const; 45 45 bool empty() const; 46 46 47 47 template< typename FormalIterator, typename ActualIterator > 48 48 void add( FormalIterator formalBegin, FormalIterator formalEnd, ActualIterator actualBegin ); 49 49 50 /// this function is unused... 50 51 template< typename TypeInstListIterator > 51 52 void extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result ); 52 53 53 54 void normalize(); 54 55 … … 63 64 /// Records type variable bindings from forall-statements and instantiations of generic types 64 65 template< typename TypeClass > Type *handleAggregateType( TypeClass *type ); 65 66 66 67 virtual Type* mutate(VoidType *basicType); 67 68 virtual Type* mutate(BasicType *basicType); … … 75 76 virtual Type* mutate(TupleType *tupleType); 76 77 virtual Type* mutate(VarArgsType *varArgsType); 77 78 78 79 // TODO: worry about traversing into a forall-qualified function type or type decl with assertions 79 80 80 81 void initialize( const TypeSubstitution &src, TypeSubstitution &dest ); 81 82 … … 136 137 return subCount; 137 138 } 138 139 139 140 template< typename SynTreeClass > 140 141 int TypeSubstitution::applyFree( SynTreeClass *&input ) { … … 149 150 return subCount; 150 151 } 151 152 152 153 template< typename TypeInstListIterator > 153 154 void TypeSubstitution::extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result ) { 155 // xxx - this function doesn't extract varEnv - is this intentional? 154 156 while ( begin != end ) { 155 157 TypeEnvType::iterator cur = typeEnv.find( (*begin++)->get_name() ); … … 173 175 } 174 176 177 std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub ); 178 175 179 #endif // TYPESUBSTITUTION_H 176 180
Note: See TracChangeset
for help on using the changeset viewer.