Changeset 447c356
- Timestamp:
- Oct 19, 2017, 11:15:35 AM (7 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:
- 6fc5c14
- Parents:
- 84733c1
- git-author:
- Rob Schluntz <rschlunt@…> (10/17/17 10:25:17)
- git-committer:
- Rob Schluntz <rschlunt@…> (10/19/17 11:15:35)
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.h
r84733c1 r447c356 238 238 virtual Attribute * mutate( Attribute * attribute ) override final; 239 239 240 virtual TypeSubstitution * mutate( TypeSubstitution * sub ) final; 241 240 242 private: 241 243 template<typename pass_t> friend void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor ); -
src/Common/PassVisitor.impl.h
r84733c1 r447c356 2127 2127 MUTATE_BODY( Attribute, node ); 2128 2128 } 2129 2130 template< typename pass_type > 2131 TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) { 2132 MUTATE_START( node ); 2133 2134 for ( auto & p : node->typeEnv ) { 2135 indexerScopedMutate( p.second, *this ); 2136 } 2137 for ( auto & p : node->varEnv ) { 2138 indexerScopedMutate( p.second, *this ); 2139 } 2140 2141 MUTATE_END( TypeSubstitution, node ); 2142 } -
src/SynTree/Mutator.cc
r84733c1 r447c356 626 626 } 627 627 628 TypeSubstitution * Mutator::mutate( TypeSubstitution * sub ) { 629 for ( auto & p : sub->typeEnv ) { 630 p.second = maybeMutate( p.second, *this ); 631 } 632 for ( auto & p : sub->varEnv ) { 633 p.second = maybeMutate( p.second, *this ); 634 } 635 return sub; 636 } 637 628 638 // Local Variables: // 629 639 // tab-width: 4 // -
src/SynTree/Mutator.h
r84733c1 r447c356 117 117 118 118 virtual Attribute * mutate( Attribute * attribute ); 119 120 virtual TypeSubstitution * mutate( TypeSubstitution * sub ); 119 121 private: 120 122 virtual Declaration * handleAggregateDecl(AggregateDecl * aggregateDecl ); -
src/SynTree/TypeSubstitution.cc
r84733c1 r447c356 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 } … … 231 229 Type * TypeSubstitution::mutate( OneType *oneType ) { 232 230 return handleType( oneType ); 233 }234 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 231 } 244 232 -
src/SynTree/TypeSubstitution.h
r84733c1 r447c356 59 59 void normalize(); 60 60 61 TypeSubstitution * acceptMutator( Mutator & m utator );61 TypeSubstitution * acceptMutator( Mutator & m ) { return m.mutate( this ); } 62 62 63 63 void print( std::ostream &os, Indenter indent = {} ) const; … … 89 89 90 90 void initialize( const TypeSubstitution &src, TypeSubstitution &dest ); 91 92 friend class Mutator; 93 94 template<typename pass_type> 95 friend class PassVisitor; 91 96 92 97 typedef std::map< std::string, Type* > TypeEnvType;
Note: See TracChangeset
for help on using the changeset viewer.