Changeset 5382492 for src/SynTree
- Timestamp:
- Apr 26, 2016, 11:36:36 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 668edd6b
- Parents:
- cf18eea
- Location:
- src/SynTree
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/TypeSubstitution.cc
rcf18eea r5382492 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TypeSubstitution.cc -- 7 // TypeSubstitution.cc -- 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:29:15201611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Apr 26 11:15:29 2016 13 13 // Update Count : 3 14 14 // … … 96 96 BoundVarsType::const_iterator bound = boundVars.find( inst->get_name() ); 97 97 if ( bound != boundVars.end() ) return inst; 98 98 99 99 TypeEnvType::const_iterator i = typeEnv.find( inst->get_name() ); 100 100 if ( i == typeEnv.end() ) { … … 217 217 } 218 218 219 std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub ) { 220 sub.print( out ); 221 return out; 222 } 223 224 219 225 // Local Variables: // 220 226 // tab-width: 4 // -
src/SynTree/TypeSubstitution.h
rcf18eea r5382492 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 : Tue Apr 26 11:15:07 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 50 template< typename TypeInstListIterator > 51 51 void extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result ); 52 52 53 53 void normalize(); 54 54 … … 63 63 /// Records type variable bindings from forall-statements and instantiations of generic types 64 64 template< typename TypeClass > Type *handleAggregateType( TypeClass *type ); 65 65 66 66 virtual Type* mutate(VoidType *basicType); 67 67 virtual Type* mutate(BasicType *basicType); … … 75 75 virtual Type* mutate(TupleType *tupleType); 76 76 virtual Type* mutate(VarArgsType *varArgsType); 77 77 78 78 // TODO: worry about traversing into a forall-qualified function type or type decl with assertions 79 79 80 80 void initialize( const TypeSubstitution &src, TypeSubstitution &dest ); 81 81 … … 136 136 return subCount; 137 137 } 138 138 139 139 template< typename SynTreeClass > 140 140 int TypeSubstitution::applyFree( SynTreeClass *&input ) { … … 149 149 return subCount; 150 150 } 151 151 152 152 template< typename TypeInstListIterator > 153 153 void TypeSubstitution::extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result ) { … … 173 173 } 174 174 175 std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub ); 176 175 177 #endif // TYPESUBSTITUTION_H 176 178
Note:
See TracChangeset
for help on using the changeset viewer.