Changeset 3f7e12cb for src/SynTree/TypeSubstitution.cc
- Timestamp:
- Nov 8, 2017, 5:43:33 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 954908d
- Parents:
- 78315272 (diff), e35f30a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/TypeSubstitution.cc
r78315272 r3f7e12cb 148 148 template< typename TypeClass > 149 149 Type *TypeSubstitution::handleType( TypeClass *type ) { 150 BoundVarsTypeoldBoundVars( boundVars );150 ValueGuard<BoundVarsType> oldBoundVars( boundVars ); 151 151 // bind type variables from forall-qualifiers 152 152 if ( freeOnly ) { … … 156 156 } // if 157 157 Type *ret = Mutator::mutate( type ); 158 boundVars = oldBoundVars;159 158 return ret; 160 159 } … … 162 161 template< typename TypeClass > 163 162 Type *TypeSubstitution::handleAggregateType( TypeClass *type ) { 164 BoundVarsTypeoldBoundVars( boundVars );163 ValueGuard<BoundVarsType> oldBoundVars( boundVars ); 165 164 // bind type variables from forall-qualifiers 166 165 if ( freeOnly ) { … … 177 176 } // if 178 177 Type *ret = Mutator::mutate( type ); 179 boundVars = oldBoundVars;180 178 return ret; 181 179 } … … 233 231 } 234 232 235 TypeSubstitution * TypeSubstitution::acceptMutator( Mutator & mutator ) { 236 for ( auto & p : typeEnv ) { 237 p.second = maybeMutate( p.second, mutator ); 238 } 239 for ( auto & p : varEnv ) { 240 p.second = maybeMutate( p.second, mutator ); 241 } 242 return this; 243 } 244 245 void TypeSubstitution::print( std::ostream &os, int indent ) const { 246 os << std::string( indent, ' ' ) << "Types:" << std::endl; 233 void TypeSubstitution::print( std::ostream &os, Indenter indent ) const { 234 os << indent << "Types:" << std::endl; 247 235 for ( TypeEnvType::const_iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) { 248 os << std::string( indent+2, ' ' )<< i->first << " -> ";249 i->second->print( os, indent+ 4);236 os << indent+1 << i->first << " -> "; 237 i->second->print( os, indent+2 ); 250 238 os << std::endl; 251 239 } // for 252 os << std::string( indent, ' ' )<< "Non-types:" << std::endl;240 os << indent << "Non-types:" << std::endl; 253 241 for ( VarEnvType::const_iterator i = varEnv.begin(); i != varEnv.end(); ++i ) { 254 os << std::string( indent+2, ' ' )<< i->first << " -> ";255 i->second->print( os, indent+ 4);242 os << indent+1 << i->first << " -> "; 243 i->second->print( os, indent+2 ); 256 244 os << std::endl; 257 245 } // for
Note:
See TracChangeset
for help on using the changeset viewer.