Changeset 63be3387 for src/GenPoly/GenPoly.cc
- Timestamp:
- Nov 14, 2022, 11:52:44 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 7d9598d8
- Parents:
- b77f0e1 (diff), 19a8c40 (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/GenPoly/GenPoly.cc
rb77f0e1 r63be3387 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Oct 7 15:25:00 202213 // Update Count : 1 612 // Last Modified On : Mon Oct 24 15:19:00 2022 13 // Update Count : 17 14 14 // 15 15 … … 118 118 } 119 119 120 const Type* replaceTypeInst( const Type* type, const TypeSubstitution* env ) { 121 if ( ! env ) return type; 122 if ( auto typeInst = dynamic_cast< const TypeInstType* >( type ) ) { 123 Type *newType = env->lookup( typeInst->get_name() ); 124 if ( newType ) return newType; 125 } 126 return type; 127 } 128 120 129 const ast::Type * replaceTypeInst(const ast::Type * type, const ast::TypeSubstitution * env) { 121 130 if (!env) return type; 122 if ( auto typeInst = dynamic_cast<const ast::TypeInstType*> (type)) {131 if ( auto typeInst = dynamic_cast<const ast::TypeInstType*>(type) ) { 123 132 auto newType = env->lookup(typeInst); 124 133 if (newType) return newType; … … 194 203 195 204 if ( auto inst = dynamic_cast< const ast::TypeInstType * >( type ) ) { 196 if ( typeVars.find( inst->typeString()) != typeVars.end() ) return type;205 if ( typeVars.find( *inst ) != typeVars.end() ) return type; 197 206 } else if ( auto array = dynamic_cast< const ast::ArrayType * >( type ) ) { 198 207 return isPolyType( array->base, subst ); … … 227 236 228 237 if ( auto inst = dynamic_cast<ast::TypeInstType const *>( type ) ) { 229 auto var = typeVars.find( inst->name);238 auto var = typeVars.find( *inst ); 230 239 if ( var != typeVars.end() && var->second.isComplete ) { 231 240 return inst; 232 241 } 233 242 } else if ( auto inst = dynamic_cast<ast::StructInstType const *>( type ) ) { … … 784 793 785 794 void addToTypeVarMap( const ast::TypeInstType * type, TypeVarMap & typeVars ) { 786 typeVars.insert( type->typeString(), ast::TypeDecl::Data( type->base ) );795 typeVars.insert( *type, ast::TypeDecl::Data( type->base ) ); 787 796 } 788 797 … … 816 825 } 817 826 818 void printTypeVarMap( std::ostream &os, const TypeVarMap & typeVars ) {819 for ( auto const & pair : typeVars ) {820 os << pair.first << " (" << pair.second << ") ";821 } // for822 os << std::endl;823 }824 825 827 } // namespace GenPoly 826 828
Note:
See TracChangeset
for help on using the changeset viewer.