Changeset d0d5054
- Timestamp:
- Apr 12, 2018, 5:13:04 PM (6 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, with_gc
- Children:
- 01963df
- Parents:
- 8711c6c
- git-author:
- Rob Schluntz <rschlunt@…> (04/12/18 17:07:59)
- git-committer:
- Rob Schluntz <rschlunt@…> (04/12/18 17:13:04)
- Location:
- src/SynTree
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/TypeSubstitution.cc
r8711c6c rd0d5054 149 149 return inst; 150 150 } else { 151 /// std::cerr << "found " << inst->get_name() << ", replacing with "; 152 /// i->second->print( std::cerr ); 153 /// std::cerr << std::endl; 151 // cut off infinite loop for the case where a type is bound to itself. 152 // Note: this does not prevent cycles in the general case, so it may be necessary to do something more sophisticated here. 153 // TODO: investigate preventing type variables from being bound to themselves in the first place. 154 if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) { 155 if ( inst->name == replacement->name ) { 156 return inst; 157 } 158 } 159 // std::cerr << "found " << inst->name << ", replacing with " << i->second << std::endl; 154 160 subCount++; 155 161 Type * newtype = i->second->clone(); 156 162 newtype->get_qualifiers() |= inst->get_qualifiers(); 157 163 delete inst; 158 return newtype; 164 // Note: need to recursively apply substitution to the new type because normalize does not substitute bound vars, but bound vars must be substituted when not in freeOnly mode. 165 return newtype->acceptMutator( *visitor ); 159 166 } // if 160 167 } -
src/SynTree/TypeSubstitution.h
r8711c6c rd0d5054 129 129 130 130 // definitition must happen after PassVisitor is included so that WithGuards can be used 131 struct TypeSubstitution::Substituter : public WithGuards {131 struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter> { 132 132 Substituter( TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {} 133 133
Note: See TracChangeset
for help on using the changeset viewer.